Learn R Programming

ryouready (version 0.4)

eta: Eta coefficient for nominal/interval data.

Description

Eta coefficient for nominal/interval data.

Usage

eta(x, y, breaks = NULL, na.rm = FALSE)

Arguments

x
Independent nominal variable (factor or numeric).
y
Dependent interval variable (numeric).
breaks
If x is interval data the breaks argument can be specified to classify the data. breaks is passed on to the function cut.
na.rm
Logical. Indicating if NA values are removed.

Value

Eta coefficient

Examples

Run this code
attach(d.eta)     # using d.eta dataset
eta(x1, y)

# removing missing data
eta(c(x1, 2), c(NA, y), na.rm=TRUE)   # NA added to y to show NA behaviour

# classify interval data x
eta(x, y, breaks=c(1, 4, 7,10))
# visualize classication
plot(x, y)
abline(v=c(1, 4, 7,10))

# setting number of breaks for classification
eta(x, y, breaks=7)

Run the code above in your browser using DataLab