eta2.contr: Compute (partial) eta-squared for contrast

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/variances.R

Description

Return the proportion of variance explained by the contrast over the variance not explained by other effects. The result is the partial eta-squared unless, there's only one possible contrast in the model, the is the eta-squared

Usage

1
eta2.contr(cont, xname, model)

Arguments

cont

vector of contrast weights.

xname

Character string indicating the name of the factor defining groups.

model

a lm object with xname as independent variable.

Details

Compute the eta-squared for a contrast based on a model already estimated with the effect of "xname" af a factor.

Value

A numeric value for eta-squared.

Author(s)

Marcello Gallucci, mcfanda@gmail.com

See Also

eta2.contr.d

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
### sim some data
cont<-c(-3,-1,1,3)
means<-c(10,12,10,12)
y<-rep(means,1000)+rnorm(4000,0,2)
x<-factor(rep(1:4,1000))
### compute eta-squared
mod<-lm(y~x)
eta2.contr(cont,xname = "x",model = mod)

#### check from the d coefficient
d<-d.contr(cont,x=x,y=y)
eta2.contr.d(cont = cont,d=d,scale = "g")

mcfanda/cpower documentation built on May 28, 2019, 1 p.m.