<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Prezados useRs,<br>
<br>
Sou um newbie em análise de dados categóricos, e esta é a primeira
vez que uso o pacote lavaan.<br>
<br>
Ao implementar a análise, recebo o seguinte erro:<br>
<br>
<b>Error in muthen1984(Data = X[[g]], ov.names = ov.names[[g]],
ov.types = ov.types, : </b><b><br>
</b><b> unknown ov.types:factor</b><br>
<br>
Acho que estou com problemas de sintaxe, na hora de especificar uma
variável dummy, <b>grown</b>.<br>
O código antes do erro é:<br>
<br>
#### Making dummy variables from a case with K > 2 levels ###<br>
# Transforming grown to factor<br>
raw.data$grown <- factor(raw.data$grown, labels = c("1", "2",
"3"))<br>
class(raw.data$grown)<br>
str(raw.data) #Inspecting the data set<br>
<br>
#the contrast matrix for categorical variable with three levels<br>
contr.treatment(3)<br>
#assigning the treatment contrasts to grown<br>
contrasts(raw.data$grown) = contr.treatment(3)<br>
str(raw.data) #Inspecting the data set<br>
<br>
### centering and rescaling numeric explanatory variables ###<br>
prep$lnexp_5y <- scale(prep$lnexp_5y)<br>
prep$age<-scale (prep$age)<br>
prep$yearsliving <-scale (prep$yearsliving)<br>
prep$hourshome <-scale (prep$hourshome)<br>
str(prep)<br>
<br>
# Building the model<br>
# The observed variable in black is a dummy.<br>
odor1 <- '<br>
# latent variables (measurement model)<br>
rsi =~ eyes_a + nose_a + run_nose_a +<br>
cough_a + chest_a + breath_a<br>
nsh =~ dizziness_a + concentration_a + <br>
headache_a + fatigue_a + nausea_a<br>
psy =~ risk_perception + behavioral<br>
ap =~ lnexp_5y<br>
<br>
<br>
sde =~ gender + smoking + <b>grown</b> + children + yearsliving <br>
oa =~ odor_binom<br>
<br>
#regressions (dependent ~ independent | y ~ x)<br>
rsi ~ ap + oa<br>
psy ~ ap + oa<br>
nsh ~ ap + oa + psy<br>
oa ~ ap + sde<br>
'<br>
# Fitting the model with WLSMV<br>
<a href="http://fit1.ml" target="_blank" rel="nofollow"
onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffit1.ml\46sa\75D\46sntz\0751\46usg\75AFQjCNGZqrCGc6TmzS75URauc5Yo000xfg';return
true;"
onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Ffit1.ml\46sa\75D\46sntz\0751\46usg\75AFQjCNGZqrCGc6TmzS75URauc5Yo000xfg';return
true;">fit1.ml</a> <- sem(odor1, data = prep, ordered =
c("grown"), estimator = "WLSMV")<br>
<br>
<br>
Desde já, muito obrigado.<br>
Vinícius<br>
<pre class="moz-signature" cols="72">--
Best regards,
Vinícius Lionel Mateus, MSc (<a class="moz-txt-link-freetext" href="http://lattes.cnpq.br/6501001637020665">http://lattes.cnpq.br/6501001637020665</a>)
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
<a class="moz-txt-link-freetext" href="http://www.qui.puc-rio.br/index.html">http://www.qui.puc-rio.br/index.html</a></pre>
</body>
</html>