
Prezados useRs, Sou um newbie em análise de dados categóricos, e esta é a primeira vez que uso o pacote lavaan. Ao implementar a análise, recebo o seguinte erro: *Error in muthen1984(Data = X[[g]], ov.names = ov.names[[g]], ov.types = ov.types, : ** ** unknown ov.types:factor* Acho que estou com problemas de sintaxe, na hora de especificar uma variável dummy, *grown*. O código antes do erro é: #### Making dummy variables from a case with K > 2 levels ### # Transforming grown to factor raw.data$grown <- factor(raw.data$grown, labels = c("1", "2", "3")) class(raw.data$grown) str(raw.data) #Inspecting the data set #the contrast matrix for categorical variable with three levels contr.treatment(3) #assigning the treatment contrasts to grown contrasts(raw.data$grown) = contr.treatment(3) str(raw.data) #Inspecting the data set ### centering and rescaling numeric explanatory variables ### prep$lnexp_5y <- scale(prep$lnexp_5y) prep$age<-scale (prep$age) prep$yearsliving <-scale (prep$yearsliving) prep$hourshome <-scale (prep$hourshome) str(prep) # Building the model # The observed variable in black is a dummy. odor1 <- ' # latent variables (measurement model) rsi =~ eyes_a + nose_a + run_nose_a + cough_a + chest_a + breath_a nsh =~ dizziness_a + concentration_a + headache_a + fatigue_a + nausea_a psy =~ risk_perception + behavioral ap =~ lnexp_5y sde =~ gender + smoking + *grown* + children + yearsliving oa =~ odor_binom #regressions (dependent ~ independent | y ~ x) rsi ~ ap + oa psy ~ ap + oa nsh ~ ap + oa + psy oa ~ ap + sde ' # Fitting the model with WLSMV fit1.ml <http://fit1.ml> <- sem(odor1, data = prep, ordered = c("grown"), estimator = "WLSMV") Desde já, muito obrigado. Vinícius -- Best regards, Vinícius Lionel Mateus, MSc (http://lattes.cnpq.br/6501001637020665) Chemistry PhD Student Atmospheric Chemistry Laboratory - Dep. Chemistry PUC-Rio - Pontifical Catholic University of Rio de Janeiro Rua Marquês de São Vicente, 225, Gávea - Rio de Janeiro, RJ - Brazil CEP: 22451-900 Telefone: (+45) 26 28 28 51 (+55) (21) 3527-1327 (+55) (21) 993 - 588 - 051 Skype: vinicius.lionel http://www.qui.puc-rio.br/index.html