Displaying 1 result from an estimated 1 matches for "datahealthy".
2008 Nov 11
1
simulate data with binary outcome and correlated predictors
...ous with variance =1 and correlations between predictors vary for each condition of Y.
_________
library(MASS)
N<-1000
nbX<-3
propSick<-0.2
corrSick<-.8
corrHealthy<-.9
sigma0<-matrix(corrHealthy,nbX,nbX)
diag(sigma0)<-1
sigma1<-matrix(corrSick,nbX,nbX)
diag(sigma1)<-1
dataHealthy<-mvrnorm(N*(1-propSick),c(0,0,0),sigma0)
dataSick<-mvrnorm(N*propSick,c(1,1,1),sigma1)
dataS<-as.data.frame(matrix(0,ncol=4,nrow=N))
dimnames(dataS)[[2]]<-c("IV1","IV2","IV3","DV")
dataS$DV[1:(N*propSick)]<-1
dataS$DV<-factor(dataS$DV)
data...