Dear Friends:
I am trying to learn using the MMLCR package in R (or S) for latent class
regression analysis.
I simulated data where y=4*x+error from population A and y=-4*x+error from
population B and then mixed A, B together.
I then tried to use the package to
1. uncover the latent segment
2. estimate two regression modesl, one per segment.
For some reason, (maybe due to my silly unfamiliarity with the package), I
was not able to do either with simple simulated data.
I have attached the data (very small population) and the code and hope
someone can give me some tips.
Thanks a lot.
(See attached file: TEST.dat)
read.table("c:/temp/TEST.dat",header=TRUE,sep=",")
summary(test)
lm(y~x,data=test,subset=(gender==1))
lm(y~x,data=test,subset=(gender==0))
check <-mmlcr(outer=~1|id,
component=list(list(formula=y~x,class="cnormonce")),data=test,n.groups=2)
summary(check)
check
mmlcrclassify(check)
Hongjie Wang
Fulcrum Analytics
(203) 254-5306
TEST.dat
Description: Binary data
|