Description Usage Arguments Value References Examples
Calculate the effects and degrees of freedom for a set of fully crossed effects.
1 |
vars |
(character vector) Independent Variables |
levels |
(integer vector) Levels for each of those indpendent variables respectively |
data.frame with two columns, effect (the name of the effect) and df (the df associated with that effect)
Rosenthal & Rosnow. (2008). Essentials of Behavioral Research. Boston: Mc Graw Hill.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #Table 18.24
#Calculate the within effects
within <- dfEffects(c("Expectancy","Pupil Sex"),c(2,2))
#Specify the between effects (these can't be calculated using dfEffects because they aren't fully crossed)
btwn <- data.frame(effect=c("Sex of Teacher","Teachers (within sex)"),df=c(1,8))
#Now we rbind these two and use grid.expand to explore all possible combinations
table.18.24 <- rbind(btwn,within,data.frame(effect=apply(expand.grid(btwn$effect,within$effect),1,paste,collapse=":"),df=apply(expand.grid(btwn$df,within$df),1,prod)))
# Table 18.30 uses the same between subjects effects but has a more complex within structure that we create using this function
within <- dfEffects(c("Expectancy","Pupil Sex","Diagnosis"),c(2,2,2))
rbind(btwn,within,data.frame(effect=apply(expand.grid(btwn$effect,within$effect),1,paste,collapse=":"),df=apply(expand.grid(btwn$df,within$df),1,prod)))
# Note: Obviously the order of effects is different here than in R&R.
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.