[R] Cox model -missing data.

2014-12-19 Thread aoife doherty
Hi all, I have a data set like this: Test.cox file: V1V2 V3 Survival Event ann 13 WTHomo 41 ben 20 *51 tom 40 Variant 61 where *

Re: [R] Cox model -missing data.

2014-12-19 Thread Shouro Dasgupta
First recode the * in NA: death.dat$v3[death.dat$v1==*] - NA Include this in your model: na.rm=TRUE Or you could create a new dataset: newdata - na.omit(death.dat) Shouro On Fri, Dec 19, 2014 at 11:12 AM, aoife doherty aoife.m.dohe...@gmail.com wrote: Hi all, I have a data set like

Re: [R] Cox model -missing data.

2014-12-19 Thread Ted Harding
Hi Aoife, I think that if you simply replace each * in the data file with NA, then it should work (NA is usually interpreted as missing for those functions for which missingness is relevant). How you subsequently deal with records which have missing values is another question (or many questions

Re: [R] Cox model -missing data.

2014-12-19 Thread aoife doherty
Many thanks, I appreciate the response. When I convert the missing values to NA and run the cox model as described in previous post, the cox model seems to remove all of the rows with a missing value (as the number of rows n in the cox output after I completely remove any row with missing data

Re: [R] Cox model -missing data.

2014-12-19 Thread Ted Harding
Yes, your basic reasoning is correct. In general, the observed variables carry information about the variables with missing values, so (in some way) the missing values can be replaced with estimates (imputations) and the standard regression method will then work as though the replacements were

Re: [R] Cox model -missing data.

2014-12-19 Thread Michael Dewey
Comment inline On 19/12/2014 11:17, aoife doherty wrote: Many thanks, I appreciate the response. When I convert the missing values to NA and run the cox model as described in previous post, the cox model seems to remove all of the rows with a missing value (as the number of rows n in the cox