# NOT RUN {
# lme
require(nlme)
fm1 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
plot(predictorEffects(fm1))
# gls
library(nlme)
g <- gls(Employed ~ GNP + Population,
correlation=corAR1(form= ~ Year), data=longley)
print(predictorEffects(g))
# lmer uses method Effect.lmerMod
if("package:nlme" <!-- %in% search()) detach(package:nlme) -->
require(lme4)
data("Orthodont", package="nlme")
fm2 <- lmer(distance ~ age + Sex + (1 |Subject), data = Orthodont)
plot(allEffects(fm2))
# glmer uses method Effect.lmerMod
require(lme4)
gm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
data = cbpp, family = binomial)
as.data.frame(predictorEffect("period", gm1))
# rlmer uses method Effect.rlmerMod
require(lme4)
fm3 <- robustlmm::rlmer(distance ~ age + Sex + (1 |Subject), data = Orthodont)
plot(effect("age:Sex", fm3))
plot(predictorEffects(fm3, ~ age + Sex))
# betareg from the betareg package
library(betareg)
library(lme4)
data("GasolineYield", package = "betareg")
gy_logit <- betareg(yield ~ batch + temp, data = GasolineYield)
summary(gy_logit)
Effect("batch", gy_logit)
predictorEffects(gy_logit)
# clm in ordinal
require(ordinal)
require(MASS)
mod.wvs1 <- clm(poverty ~ gender + religion + degree + country*poly(age,3),
data=WVS)
plot(Effect(c("country", "age"), mod.wvs1),
lines=list(multiline=TRUE), layout=c(2, 2))
# clm2
require(ordinal)
require(MASS)
v2 <- clm2(poverty ~ gender + religion + degree + country*poly(age,3),data=WVS)
plot(emod2 <- Effect(c("country", "age"), v2))
# clmm
require(ordinal)
require(MASS)
mm1 <- clmm(SURENESS ~ PROD + (1|RESP) + (1|RESP:PROD),
data = soup, link = "logit", threshold = "flexible")
plot(Effect("PROD", mm1),lines=list(multiline=TRUE))
# poLCA
library(poLCA)
data(election)
f2a <- cbind(MORALG,CARESG,KNOWG,LEADG,DISHONG,INTELG,
MORALB,CARESB,KNOWB,LEADB,DISHONB,INTELB)~PARTY
nes2a <- poLCA(f2a,election,nclass=3,nrep=5) # log-likelihood: -16222.32
allEffects(nes2a)
# multivariate linear model
data(Baumann, package="carData")
b1 <- lm(cbind(post.test.1, post.test.2, post.test.3) ~ group +
pretest.1 + pretest.2, data = Baumann))
plot(Effect("group", b1)
# }
Run the code above in your browser using DataLab