etas: Eta coefficients

Description Usage Arguments Value Methods (by class) Examples

View source: R/etas.R

Description

Calculate Eta coefficients, known as "Correlation ratios". Squared value of Eta has an interpretation in terms of the proportion of explained variance. The interpretation follows from a problem of predicting values of y. The value of the Eta^2 is the proportion by which the error of predicting values of y is reduced by using the information provided by x.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
etas(object, ...)

## Default S3 method:
etas(object, fac, pop_var = FALSE, ...)

## S3 method for class 'anova'
etas(object, ...)

## S3 method for class 'lm'
etas(object, ...)

Arguments

object

the R object

...

arguments passed to other methods

fac

vector for conditioning variable

pop_var

logical, whether to use population or sample variance in the calculation

Value

Values of eta and partial eta coefficients.

Methods (by class)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
### Generate some data
x1 <- rnorm(50)
x2 <- rnorm(50)
y <- 5 + 2 * x1 + rnorm(50, 0, 2) + 3 * x2 + rnorm(50, 0, .5)

### Method for vectors
etas(y, rep(1:2, each = 25))

### Method for 'lm' which calls 'anova'
m <- lm(y ~ x1 + x2)
etas(m)

mbojan/mbstats documentation built on Dec. 21, 2021, 3:56 p.m.