--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+unsubscribe@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at https://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/d/optout.
Error in checkSlotAssignment(object, name, value) :assignment of an object of class “lavModel” is not valid for slot ‘Model’ in an object of class “lavaanStar”; is(value, "Model") is not TRUE
In an earlier attempt, I ran the following code to get to the source file, but I'm getting a 404 messageinstall.packages("devtools")install.packages("lavaan", repos = "http://www.da.ugent.be", type = "source")devtools::install_github("simsem/semTools/semTools")
R version 3.4.3 (2017-11-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.3 tools_3.4.3 yaml_2.1.16 install.packages("https://github.com/simsem/semTools/blob/master/builds/semTools_0.4-15.912.tar.gz",
repos = NULL, type = "source")Version problem?
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
Error in getOctD(x, offset, len) : invalid octal digit
** WARNING ** lavaan (0.5-23.1097) model has NOT been fitted ** WARNING ** Estimates below are simply the starting values
That did the trick, except I am getting the following warning:** WARNING ** lavaan (0.5-23.1097) model has NOT been fitted
It seems that I can only use "ml" as my estimator. When I try using "mlr", I get the error messageError in if (attr(x, "information") %in% c("expected", "first.order") || :missing value where TRUE/FALSE needed
HSMiss <- HolzingerSwineford1939[ , c(paste("x", 1:9, sep = ""),
"ageyr","agemo","school")]
set.seed(12345)
HSMiss$x5 <- ifelse(HSMiss$x5 <= quantile(HSMiss$x5, .3), NA, HSMiss$x5)
age <- HSMiss$ageyr + HSMiss$agemo/12
HSMiss$x9 <- ifelse(age <= quantile(age, .3), NA, HSMiss$x9)
## specify CFA model from lavaan's ?cfa help page
HS.model <- '
visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9
'
## impute data within runMI...
out1 <- cfa.mi(HS.model, data = HSMiss, m = 20, seed = 12345,
miArgs = list(noms = "school"))
out2 <- cfa.mi(HS.model, data = HSMiss, m = 20, seed = 12345,
miArgs = list(noms = "school"), estimator = "mlm")
out3 <- cfa.mi(HS.model, data = HSMiss, m = 20, seed = 12345,
miArgs = list(noms = "school"), estimator = "mlr")
summary(out1) # ML : no error
summary(out2) # MLM: no error
summary(out3) # MLR: errorI am running SemTools version 0.4-15.tar.gz, lavaan version .6-1.1183, and R version 3.43. I get the following error messages when I run the code belowThere were 20 warnings (use warnings() to see them)> anova(fitmi, indices=TRUE)Error in anova(fitmi, indices = TRUE) :trying to get slot "imputed" from an object of a basic class ("logical") with no slots> summary(fitmi)** WARNING ** lavaan (0.6-1.1183) model has NOT been fitted** WARNING ** Estimates below are simply the starting values
It runs fine, except if I add "chi" = "mplus" to the runMI statement. Then it returns: lavaan ERROR: unknown argument 'chi'
It does work if I use the solution posted in the end of this thread, anova(fit5, indices=T), but is there a way to get the original "chi=mplus" statement to work and get the model fit measures printed in a fashion similar to lavaan?
anova(fit5, test = "mplus", indices = TRUE)Also, if I run miPowerFit it also returns "unknown 'what' argument in inspect function 'mi'...
It seems that I can only use "ml" as my estimator. When I try using "mlr", I get the error messageError in if (attr(x, "information") %in% c("expected", "first.order") || :missing value where TRUE/FALSE neededDavid
devtools::install_github("simsem/semTools/semTools")set.seed(20)
# Simulating 4 correlated variables
Sigma <- matrix(c(1, .40, .40, .45, .40, 1, .35, .50, .40, .35, 1, .40, .45, .50, .40, 1), 4, 4)
cfadat <- as.data.frame(mvrnorm(100, rep(0, 4), Sigma))
names <- colnames(cfadat) <- c("v1", "v2", "v3", "v4")
round(cor(cfadat), 3)
# MCAR - some are missing v1 and v2, some are missing v3 and v4
# Some are missing all
#set.seed(20)
prop.m <- .20
mcar1 <- runif(100, min = 0, max = 1)
mcar2 <- runif(100, min = 0, max = 1)
cfadat$v1.mcar <- ifelse(mcar1 < prop.m, NA, cfadat$v1)
cfadat$v2.mcar <- ifelse(mcar1 < prop.m, NA, cfadat$v2)
cfadat$v3.mcar <- ifelse(mcar2 < prop.m, NA, cfadat$v3)
cfadat$v4.mcar <- ifelse(mcar2 < prop.m, NA, cfadat$v4)
head(round(cfadat, 4), 20)
cfadat.miss <- cfadat[, 5:8]head(cfadat.miss)
# CFA with multiple imputations-------m1 <- 'f1 =~ v1.mcar + v2.mcar + v3.mcar + v4.mcar'
# Using semToolsout.mi1 <- cfa.mi(m1, data = cfadat.miss, m = 10, estimator = "MLR", seed = 20)out.mi2 <- cfa.mi(m1, data = cfadat.miss, m = 10, seed = 20)
# To get fit measureslavaan::anova(out.mi1, test = "D2", indices = TRUE)lavaan::anova(out.mi2, test = "D2", indices = TRUE)
summary(out.mi1)summary(out.mi2)lavaan::anova(out.mi, test = "D2", indices = TRUE)
produces the errorError in baseOut[["chisq.shift.parameters"]] : subscript out of bounds
ERROR: failed to lock directory 'C:/Users/lrutkows/Documents/R/R-3.4.3/library' for modifying
Try removing 'C:/Users/lrutkows/Documents/R/R-3.4.3/library/00LOCK-semTools'
In R CMD INSTALL
Installation failed: Command failed (3)unlink("C:/Users/lrutkows/Documents/R/R-3.4.3/library/00LOCK-semTools", recursive = TRUE)