## artificial data
factors <- expand.grid(A=factor(1:3),
B=factor(1:2),
C=factor(1:3),
D=factor(1:2))
Freq <- rpois(nrow(factors), lambda=40)
df <- cbind(factors, Freq)
mods3 <- Kway(Freq ~ A + B + C, data=df, family=poisson)
LRstats(mods3)
mods4 <- Kway(Freq ~ A + B + C + D, data=df, family=poisson)
LRstats(mods4)
# JobSatisfaction data
data(JobSatisfaction, package="vcd")
modSat <- Kway(Freq ~ management+supervisor+own,
data=JobSatisfaction,
family=poisson, prefix="JobSat")
LRstats(modSat)
anova(modSat, test="Chisq")
# Rochdale data: very sparse, in table form
data(Rochdale, package="vcd")
if (FALSE) {
modRoch <- Kway(Freq~EconActive + Age + HusbandEmployed + Child +
Education + HusbandEducation + Asian + HouseholdWorking,
data=Rochdale, family=poisson)
LRstats(modRoch)
}
Run the code above in your browser using DataLab