Hello All;
I have fitted an SEM model with latent variable and also endogenous categorical variable as shown below:
model <- 'LU =~ AreaType+PopDen_Sc
LU ~ Male+1adult+FT+manual+Prof+skilledmanual+50kandover+lessthan25k
NoCar ~ LU+Male+1adult+FT+manual+Prof+skilledmanual+50kandover+lessthan25k
TTT_HBW ~ LU+Male+1adult+FT+manual+Prof+skilledmanual+50kandover+lessthan25k+NoCar
TTT_Sh ~ LU+Male+1adult+FT+manual+Prof+skilledmanual+50kandover+lessthan25k+NoCar
TTT_Sh ~ TTT_HBW'
My Question:
How can I weight my sample. My dataset has a weight variable (W) which should be applied to have weighted regressions in order to correct the under-representation for some of the records (ie. individuals) in my dataset.
I did try survey design as below but it produce an error message.
modelFit <- sem(model = model, ordered=c("AreaType","NoCar"),
std.lv = TRUE, data = WorkData, estimator="WLSMV") - This converged normally
surveydesign <- svydesign(ids=~0,probs=~W, data = WorkData)
lavaan.survey (modelFit, surveydesign)
This produce the following error message:
Error in t(x) - xbar : non-numeric argument to binary operator
I am wondering if there is a better/correct way to specify weights (W is a variable in my model (i.e. a column in data frame)) like weights ="W" in MPLUS.
Many Thanks
Kaveh Jahanshahi
PhD Student
Department of Urban Planning
University of Cambridge
1-5 Scroope Terrace
Cambridge
CB2 1PX