SLIDE 2 R Code R Code
#test run of 1000 simulations #test run of 1000 simulations T < T <-
1000 C < C <-
30 zM zM< <-
matrix(rep(0,C*T),nrow T),nrow=T) =T) for(i for(i in (1:T)) { in (1:T)) { #the #the zM zM simulations simulations system("c:/temp/simlem/lem system("c:/temp/simlem/lem c:/temp/simlem/SimM1a.inp c:/temp/simlem/SimM1a.inp c:/temp/simlem/SimM.out c:/temp/simlem/SimM.out") ") system("c:/temp/simlem/lem system("c:/temp/simlem/lem c:/temp/simlem/Sim5E1.inp c:/temp/simlem/Sim5E1.inp c:/temp/simlem/Sim5E.out") c:/temp/simlem/Sim5E.out") a1< a1<-
- read.table("c:/temp/simlem/simla.out")[4,]
read.table("c:/temp/simlem/simla.out")[4,] … … … … b4< b4<-
- read.table("c:/temp/simlem/simla.out")[17,]
read.table("c:/temp/simlem/simla.out")[17,] b5< b5<-
- read.table("c:/temp/simlem/simla.out")[21,]
read.table("c:/temp/simlem/simla.out")[21,] a < a <-
a1+a2+a3+a4+a5 b < b <-
b1+b2+b3+b4+b5 if (a<b) { if (a<b) { zM[i,1]< zM[i,1]<-
- read.table("c:/temp/simlem/simla.out")[2,]
read.table("c:/temp/simlem/simla.out")[2,] } } else { else { zM[i,1]< zM[i,1]<-
- read.table("c:/temp/simlem/simla.out")[3,]
read.table("c:/temp/simlem/simla.out")[3,] } } … … … … } }
Example: Latent Class Analysis Example: Latent Class Analysis
- Assuming for the data the model structure:
Assuming for the data the model structure:
Varying
presence of non-
naï ïve MNAR association ve MNAR association
- true latent class proportions
true latent class proportions
sample size
- Using the model to estimate
Using the model to estimate
( )
V V u u u u u u u u u u u u u m
r x XE xe XD xd XC xc XB xb XA xa j R j E e D d C c B b A a X x xabcder
− + + + + + + + + + + + + + =
∑
* * *
log β
π=0.1,β=0 π=0.1,β=1 π=0.2,β=0 π=0.2,β=1 π=0.3,β=0 π=0.3,β=1 π=0.4,β=0 π=0.4,β=1 π=0.5,β=0 π=0.5,β=1 40 60 80 100 120 140
Violin Plots of Likelihood Ratio of 1,000 Simulations (N=200) by True Latent Class Proportion and Association Parameter
Likelihood Ratio Statistic π=0.1,β=0 π=0.1,β=1 π=0.2,β=0 π=0.2,β=1 π=0.3,β=0 π=0.3,β=1 π=0.4,β=0 π=0.4,β=1 π=0.5,β=0 π=0.5,β=1 −560 −540 −520 −500 −480
Violin Plots of BIC of 1,000 Simulations (N=200) by True Latent Class Proportion and Association Parameter
BIC