On Thu, May 10, 2012 at 7:41 PM, Grace Ma <grace.yanfe...@gmail.com> wrote: > Hi, > I am trying to simulate a regression on survival data under a few > conditions: > 1. Under different error distributions > 2. Have the error term be dependent on the covariates > > But I'm not sure how to specify either conditions. I am using the Design > package to perform the survival analysis using the survreg, bj, coxph > functions. Any help is greatly appreciated. > > This is what I have so far: > survtime <- 10*rexp(500) #distribution of survival time > cens <- ifelse(survtime > 10, 0, 1) #indicator for censored/observed > survtime <- pmin(survtime, 10) #new survival time values with censored > info > age <- rnorm(200, 40, 10) #age variable > race <- factor(sample(c('a','b'),500,TRUE)) #categorical variable > test <- bj(Surv(survtime, cens) ~ rcs(age,5) + race) > > [[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.
-- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ ______________________________________________ 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.