massLMorLVM | R Documentation |
Multiple Linear Regressions or Single LVM
massLMorLVM(formula, data, exposure, outcomes = NULL, ...)
formula |
[formula or list of formula] formula whose right hand side indicates the covariantes. The left hand side is ignored. |
data |
[data.frame] dataset |
exposure |
[character] the name of one variable in the formula whose effect should be assessed. |
outcomes |
[character vector] name of the outcomes. |
... |
arguments passed to |
## Not run:
mSim <- lvm(c(Y1,Y2,Y3,Y4,Y5) ~ 2*eta + age, eta ~ E)
categorical(mSim, labels = c("yes","no")) <- ~E
latent(mSim) <- ~eta
d <- lava::sim(mSim, n = 1e2, latent = FALSE)
out <- massLMorLVM(~age+E, data = d, exposure = "E",
outcomes = c("Y1","Y2","Y3","Y4","Y5"))
summary(out$model$lm[[1]])$coefficient["Eno",,drop=FALSE]
summary(out$model$lvm)$coef["Y1~Eno",,drop=FALSE]
c(var.lm = sigma(out$model$lm[[1]])^2,
var.lvm = as.double(coef(out$model$lvm)["Y1~~Y1"] + coef(out$model$lvm)["eta~~eta"]))
lapply(out$glht, summary)
dL <- melt(cbind(id = 1:NROW(d),d), id.vars = c("id","E","age"))
dL$variable <- as.factor(dL$variable)
e.gls <- gls(value ~ variable*E + variable*age,
correlation = corSymm(form =~ as.numeric(variable)|id),
weights = varIdent(form =~ 1|variable),
data = dL)
summary(e.gls)$tTable
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.