sem.fitres | R Documentation |
It calculates the expected values and the residuals of a sem model.
sem.fitres(object) obs.fitres(object) lat.fitres(object)
object |
An object of class |
The main function, sem.fitres()
, calls one of the other two routines depending on the type of the model. If model does not contain latent variables, sem.fitres()
calls the function obs.fitres()
, otherwise calls the function lat.fitres()
.
The functions obs.fitres()
and lat.fitres()
are internal functions, do not use it directly.
Returns a data frame containing:
1) The observed model variables; 2) The expected values on dependent variables (indicated with hat.
); 3) The residuals on dependent variables (indicated with e.
)
In order to compute more interpretable fitted values and residuals, model is forced to have meanstrucure = TRUE
and std.lv = TRUE
.
Massimiliano Pastore
data("PDII") model <- " F1 =~ y1+y2+y3+y4 " fit0 <- sem(model, data=PDII) out <- sem.fitres(fit0) head(out) par(mfrow=c(2,2)) plot(e.y1~hat.y1,data=out) plot(e.y2~hat.y2,data=out) plot(e.y3~hat.y3,data=out) plot(e.y4~hat.y4,data=out) qqnorm(out$e.y1); qqline(out$e.y1) qqnorm(out$e.y2); qqline(out$e.y2) qqnorm(out$e.y3); qqline(out$e.y3) qqnorm(out$e.y4); qqline(out$e.y4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.