hello, I have a problem in how to generate data in a simulation study. I have a logistic model to evaluate p by 3 covariates. I need to generate 4 variables: the binary outcome Y and 3 covariates: gender (binary) and aps and tiss (continuous variables). I have the logistic model which is the expected model: log(p(y=1)/(1-p(y=1))=-1.659-0.05*sex+0.063*aps+0.04*tiss0)
I generate the outcome y like this: for (i in 1:500){ z1[i] <- rbinom(1, 1, .6) x1[i] <- rbinom(1, 1, .95) y1[i] <- z1[i]*x1[i] } my question is : how to generate the covariates aps, which can get values between 2-37, and tiss, which can get values between 9-36. I want at the and to get similar results as the expected model. Thank you, Sigalit. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list 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.