User Tools

Site Tools


lab:process_results
## Process the results from simulation for missing data mediation analysis
 
setwd("H:\\Private\\bootmedem\\l-20")
 
res<-read.table("res-N100-miss0.2.txt")
 
sumres<-cbind(apply(res,2,mean),apply(res,2,sd))
 
## estimates and the standard deviation
cbind(sumres[37:41,1],sumres[77:81,1],sumres[117:121,1],sumres[157:161,1])
cbind(sumres[37:41,2],sumres[77:81,2],sumres[117:121,2],sumres[157:161,2])
 
## coverage probability
cvg<-NULL
for (i in 0:3){
cvg<-cbind(cvg,c(sum(res[,38+40*i]<.3481 & res[,41+40*i]>.3481),sum(res[,39+40*i]<.3481 & res[,40+40*i]>.3481)))
}
cvg
 
## power
power<-NULL
 
for (i in 0:3){
  power<-cbind(power,c(sum(res[,38+40*i]>0), sum(res[,39+40*i]>0)))
}
 
power

To process the true distribution

setwd("H:\\Private\\bootmedem\\population\\50-14")
res<-read.table("res-N500.14.txt")
 
sumres<-cbind(apply(res,2,mean),apply(res,2,sd))
 
effectsize<-.14^2
 
## estimates and the standard deviation
## coverage probability
cvg<-NULL
for (i in 0:0){
cvg<-cbind(cvg,c(sum(res[,38+40*i]<effectsize & res[,41+40*i]>effectsize),sum(res[,39+40*i]<effectsize & res[,40+40*i]>effectsize)))
}
 
## power
power<-NULL
 
for (i in 0:0){
  power<-cbind(power,c(sum(res[,38+40*i]>0), sum(res[,39+40*i]>0)))
}
 
cbind(sumres[37:41,1],sumres[37:41,2])
cbind(cvg,power)/dim(res)[1]
lab/process_results.txt · Last modified: 2016/01/24 09:48 by 127.0.0.1