EffectMethods {effects} | R Documentation |
The Effect
, effect
and predictorEffects
methods are used to draw effects plots to visualize a fitted regression surface. These plots can be drawn at least in principle for any model that uses a linear predictor. Methods for modeling paradigms than the basic lm
, glm
, multinom
and polr
methods are documented here.
## Default S3 method: Effect(focal.predictors, mod, ..., sources=NULL) ## S3 method for class 'gls' Effect(focal.predictors, mod, ...) ## S3 method for class 'clm2' Effect(focal.predictors, mod, ...) ## S3 method for class 'clmm' Effect(focal.predictors, mod, ...) ## S3 method for class 'clm' Effect(focal.predictors, mod, ...) ## S3 method for class 'merMod' Effect(focal.predictors, mod, ..., KR=FALSE) ## S3 method for class 'rlmerMod' Effect(focal.predictors, mod, ...) ## S3 method for class 'lme' Effect(focal.predictors, mod, ...) ## S3 method for class 'poLCA' Effect(focal.predictors, mod, ...) ## S3 method for class 'mlm' Effect(focal.predictors, mod, response, ...) ## S3 method for class 'betareg' Effect(focal.predictors, mod, ...)
focal.predictors |
a character vector of one or more predictors in the model in any order. |
mod |
a fitted model object of the appropriate class. |
... |
additional arguments passed to other |
response |
for an |
sources |
This argument appears only in the default method for
|
KR |
if |
Most of these methods simply call the Effect.default
method with the appropriate values in the arguement sources
. See the vignettte Effect Methods in the vignettes for the effects package. All the iteresting work is done by the methods described in Effect
.
See Effect
John Fox jfox@mcmaster.ca, Sanford Weisberg sandy@umn.edu
Vignette for this package
Effect
and the links therein.
## 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" 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(robustlmm) fm3 <- rlmer(distance ~ age + Sex + (1 |Subject), data = Orthodont) plot(effect("age:Sex", fm3)) plot(predictorEffects(fm3, ~ age + Sex)) # 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)) # clm2 require(ordinal) require(MASS) v2 <- clm2(poverty ~ gender + religion + degree + country*poly(age,3),data=WVS) as.data.frame(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") as.data.frame(Effect("PROD", mm1)) # 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) # 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) ## End(Not run)