Hello all: I'm attempting to run a Cox proportional hazards function on survival data from insects and I have a few questions.
My current command that I'm using to call the model is as follows (using coxph() from the survival library): coxph(Surv(day, censor) ~ treatment + room + chamber %in% treatment, data = data.table) Day indicates which day a particular observation occurred, and censor indicates the type of observation; that is, mortality or emergence. My first question is: how do I code my censor variable? I am interested in treatment effects on mortality, and the mortality observations are currently coded as a 1 in the censor variable. Emergence is another mechanism by which the insects in my study may leave the system, similar to a patient opting out in the middle of a clinical study, and are coded as a 0. I also have a nested and block variable that I'm unsure of how to deal with. Chamber is nested within treatment, where each chamber has a maximum of 4 observations or insects, all within 1 treatment. The block variable is room, where each room contains ~40 chambers each of which has been randomly assigned a treatment. I believe that I have chamber %in% treatment right in representing my data, but how do I account for room as a block? Additionally, I have a frequency column in data.table that indicates how many of a particular observation occurred in each row. Is it appropriate to assign this column as a weigh argument in cosph? If so, how is that done? I can send sample data if necessary. Thanks for any help! Justin Montemarano [[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.