Hi all,

I have a data set like this:

Test.cox file:

V1        V2         V3                Survival       Event
ann      13          WTHomo          4                1
ben      20          *                        5                1
tom      40         Variant               6                1

where "*" indicates that I don't know what the value is for V3 for Ben.

I've set up a Cox model to run like this:

#!/usr/bin/Rscript
library(bdsmatrix)
library(kinship2)
library(survival)
library(coxme)
death.dat <- read.table("Test.cox",header=T)
deathdat.kmat <-2*with(death.dat,makekinship(famid,ID,faid,moid))
sink("Test.cox.R.Output")
Model <- coxme(Surv(Survival,Event)~ strata(factor(V1)) +
strata(factor(V2)) + factor(V3)) +
(1|ID),data=death.dat,varlist=deathdat.kmat)
Model
sink()


As you can see from the Test.cox file, I have a missing value "*". How do I
alter the R script to include "treat * as a missing variable". If I can't
incorporate missing values into the model, I assume the alternative is to
remove all of the rows with missing data, which will greatly reduce my data
set, as most rows have at least one missing variable.

Thanks

On Wed, Dec 17, 2014 at 5:19 PM, <r-help-ow...@r-project.org> wrote:
>
> Message rejected by filter rule match
>
>
>
> ---------- Forwarded message ----------
> From: Eva Marie <aoife.marie.dohe...@gmail.com>
> To: r-help@r-project.org
> Cc:
> Date: Wed, 17 Dec 2014 09:09:52 -0800 (PST)
> Subject: exclude missing co-variable data in cox model
> Hi all,
>
> I have a data set like this:
>
> Test.cox file:
>
>
>
> where "*" indicates that I don't know what the value is for V3 for Ben.
>
> I've set up a Cox model to run like this:
>
>
>
>
> As you can see from the Test.cox file, I have a missing value "*". How and
> where do I tell the R script "treat * as a missing variable". If I can't
> incorporate missing values into the model, I assume the alternative is to
> remove all of the rows with missing data, which will greatly reduce my data
> set, as most rows have at least one missing variable.
>
> Thanks
>
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/exclude-missing-co-variable-data-in-cox-model-tp4700864.html
> Sent from the R help mailing list archive at Nabble.com.
>
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to