Hi,
I am trying to run a model in lavaan where I have 3 numerical measured variables (hematocrit, ratio body mass to head length and buffy coat). Those variables are not highly correlated. Thus I want to build the composite (latent) variable "body condition" from those variables that affects the measured variable survival probability (which is a categorical 0/1) variable and nested in location.
My code looks like this:
M$Surv<-ordered(M$Surv) #ordering the Survival variable
Cmod.1 <- 'Comp <~ 1*Mass_Tohe + avgBC+avgTotCell
Surv ~ Comp' #building composite var and regress the comp to survival, this works
Cmod.1.fit <- sem(Cmod.1, data=M, ordered = "Surv") #using sem function
When using the sem function I get the following error that I don't know how to fix:
Error in start[th.idx] <- th.values[match(th.names.lavpartable, th.names.sample)] :
replacement has length zero
In addition: Warning message:
In lav_partable_check(lavpartable, categorical = lavoptions$categorical, :
lavaan WARNING: missing intercepts are set to zero: [Comp]
The next step is to use lavaan.survey package in order to use a nested model with the following code:
design<-svydesign(ids=~Loc, nest=T, data=M)
fit.adj<-lavaan.survey(lavaan.fit=fit, survey.design=design)
summary(fit.adj, rsq=T)
I got warning messages. The second one is the same as I already got in the lavaan package. How should I handle those warning messages:
Warning message:
In svydesign.default(ids = ~Loc, nest = T, data = M) :
No weights or probabilities supplied, assuming equal probability
Warning message:
In lav_partable_check(lavpartable, categorical = lavoptions$categorical, :
lavaan WARNING: missing intercepts are set to zero: [Comp]
Thank you!
Best wishes,
Magali