> On Jul 7, 2016, at 4:31 AM, Yahoo Mail via R-help <r-help@r-project.org> 
> wrote:
> 
> Dear all,
> 
> I am not able to find a reliable r code to run a multilevel latent class 
> model. Indeed, I have to analyze how social trust (three variables form the 
> ESS survey) might vary between countries (21 countries in my database). I 
> tried to use the poLCA package but I am not sure if my code is right. This is 
> my code:
> lca <-cbind(ppltrst+1,pplfair+1,pplhlp+1)~cntry
> lc <- poLCA(lca,mydata)
> 

The documentation for the 'ppltrst' variable in the documentation I see has 
that name in all caps:

http://www.europeansocialsurvey.org/docs/round6/survey/ESS6_appendix_a7_e02_1.pdf


> However, I get an error message:
> Error in `[.data.frame`(data, , match(colnames(y), colnames(data))[j]) : 
> undefined columns selected

Check your spelling of all variables:

 lchar <- character(); for( i in 2:4){ lchar=c(lchar, 
as.character(lca[[2]][[i]][[2]]))}
 lchar
#[1] "ppltrst" "pplfair" "pplhlp" 
all( c( lchar, 'cntry') %in% colnames(mydata) )

> 
> How can I solve this? Is the code completely wrong or I missed some passages?
> Thank you very much for your help!


-- 

David Winsemius
Alameda, CA, USA

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to