effectsplot {psychomix} | R Documentation |
Generic function for visualizing the effects of concomitant variables in finite mixture models.
effectsplot(object, ...)
object |
Fitted model object. |
... |
Arguments passed to |
effectsplot
is set up to be both an S3 and S4 generic.
The idea is that it provides the glue needed to extract the concomitant
part from a mixture model: First, the concomitant model is
refitted as a multinom
object or glm
object (in case of
a mixture with two components). Second, effect
or allEffects
from the effects package
is called to extract the effects of the concomitants. Third,
the corresponding plot
methods from the effects
package create the display.
Currently, this is implemented for raschmix
,
btmix
, and mptmix
objects. The interface is not
yet fully tested and may change in future versions.
Fox, J. (2003). Effect Displays in R for Generalised Linear Models. Journal of Statistical Software, 8(15), 1–27. doi:10.18637/jss.v008.i15
Fox, J., and Hong, J. (2009). Effect Displays in R for Multinomial and Proportional-Odds Logit Models: Extensions to the effects Package. Journal of Statistical Software, 32(1), 1–24. doi:10.18637/jss.v032.i01
effect
, allEffects
,
multinom
, glm
## data on party preferences in Germany
## (omit single observation with education = 1)
data("GermanParties2009", package = "psychotools")
gp <- subset(GermanParties2009, education != "1")
gp$education <- factor(gp$education)
## fit Bradley-Terry mixture, see ?btmix for more details
## and a fully-worked example
suppressWarnings(RNGversion("3.5.0"))
set.seed(2)
cm4 <- btmix(preference ~ gender + education + age + crisis, data = gp, k = 4, nrep = 1)
## inspect mixture and effects
library("lattice")
xyplot(cm4)
effectsplot(cm4)
## vis effects package directly
if(require("effects")) {
eff4 <- allEffects(cm4)
plot(eff4)
}