Ik kon zo snel niet zien dat er een beschrijving staat bij de gorica mbt het lavaan object. Zo weet de gebruiker ook niet dat er een 'standardize=TRUE' optie/command is...
Zie evt code hieronder.
Load the gorica and lavaan libraries.
if (!require("gorica")) install.packages("gorica") # install this package first (once)
if (!require("lavaan")) install.packages("lavaan") # install this package first (once)
library(gorica)
library(lavaan)
Specify the latent regression model
model2 <- '
A =~ Ab + Al + Af + An + Ar + Ac
B =~ Bb + Bl + Bf + Bn + Br + Bc
A ~ B + age + peabody
'
Fit the latent regression model using the lavaan sem function
fit2 <- sem(model2, data = sesamesim, std.lv = TRUE)
Ik kon zo snel niet zien dat er een beschrijving staat bij de gorica mbt het lavaan object. Zo weet de gebruiker ook niet dat er een 'standardize=TRUE' optie/command is... Zie evt code hieronder.
Load the gorica and lavaan libraries.
if (!require("gorica")) install.packages("gorica") # install this package first (once) if (!require("lavaan")) install.packages("lavaan") # install this package first (once) library(gorica) library(lavaan)
Specify the latent regression model
model2 <- ' A =~ Ab + Al + Af + An + Ar + Ac B =~ Bb + Bl + Bf + Bn + Br + Bc A ~ B + age + peabody '
Fit the latent regression model using the lavaan sem function
fit2 <- sem(model2, data = sesamesim, std.lv = TRUE)
Formulate hypotheses
hypotheses2 <- " A~B > A~peabody = A~age = 0; A~B > A~peabody > A~age = 0; A~B > A~peabody > A~age > 0 "
Call gorica
Note: because more than 1 hypothesis, we cannot use: comparison = "complement"
set.seed(100) out2_c <- gorica(fit2, hypotheses2, standardize=TRUE) out2_c