etas: Calculate Eta coefficients

Description Usage Arguments Details Value Examples

View source: R/etas.R

Description

This generic function calculates Eta coefficients which are also known as “Correlation ratios” or (the squared value) as the “Proportion of explained variance”.

Usage

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

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

## 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

Details

The Eta coefficient (more specifically its squared value) has a interpretation in terms of the proportion of explained variance.

In the decision theory the interpretation is related to the identification problem that involves two variables: y and x. The task is two identify the 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 contained in x.

For numeric vectors the function requires additional argument: a vector of the same length as the first. The result is a value of the Eta^2 assuming that we want to predict the values of object with the values of fac using the so called “Type I regression of means”.

For two variables y and x the Eta is given by the formula:

Eta^2 = ( D^2(y) - E[D^2(y|x)] ) / D^2(y)

For objects of class anova the function calculates the Eta's and Partial Eta Squares for all effects in the given model. In this setting the eta squares for the given effect are equal to:

SSeffect / SStotal

where SS are apropriate Sums of Squares. The “Partial Eta Squares” for the given effect are equal to:

SSeffect / (SSeffect+SSresid)

For objects of class lm the function is applied on the result of calling anova.

Value

Values of eta and partial eta coefficients.

Examples

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

# method for numeric
etas( y, rep(1:2, each=25) )

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

mbojan/mbtools documentation built on Nov. 9, 2017, 3:21 p.m.