[R] Fwd: CoxME: Family relatedness
Marie Dogherty
marie.dogherty79 at gmail.com
Mon Sep 15 12:27:26 CEST 2014
Hello all,
I have a table like this, with ~300 individuals:
Famid Id Faid Moid Cohort Sex Survival Event SNP1 SNP2 SNP3
1 1 0 0 0 0 10 1 0 1 0
2 2 0 0 1 1 20 1 0 0 0
2 3 0 0 0 0 25 1 0 1 0
4 5 1 2 0 0 35 1 0 1 1
4 6 1 2 0 0 35 0 1 0 1
famid=family id, id=id of person,faid=father id,moid=mother id.
My question of interest: What impact does SNP1/SNP2/SNP3 have on survival
of individuals (Id), after accounting for possible effects due to family
relatedness (Famid).
So I want to account for family-specific frailty effects, and individual
frailty effects according to degree of relationship between individuals.
The commands I've used are:
Library(survival)
Library(coxme)
Library(kinship2)
Library(bdsmatrix)
Death.dat <-read.table(“Table”,header=T)
deathdat.kmat
<-makekinship(famid=death.dat$famid,id=death.dat$id,father=death.dat$faid,mother=death.dat$moid)
death.dat1<-subset(death.dat,!is.na(Survival))
all <-dimnames(deathdat.kmat)[[1]]
temp <-which(!is.na(death.dat$Survival[match(all,death.dat$id)]))
deathdat1.kmat <-deathdat.kmat[temp,temp]
model4
<-coxme(Surv(Survival,Event)~Sex+strata(Cohort)+SNP1+SNP2+SNP3,data=death.dat1,id|famid,varlist=list(deathdat1.kmat,famblockf.mat),pdcheck=FALSE)
I almost completely edited these commands from :
http://www.ncbi.nlm.nih.gov/pubmed/21786277 as I am new to R.
The error I obtain is:
Error in coxme(Surv(Survival, Event) ~ Sex + strata(Cohort) + SNP1 + SNP2
+ :
No observations remain in the data set
In addition: Warning message:
In Ops.factor(id, famid) : | not meaningful for factors
I have two questions:
1. What is the difference between (id|famid) and (1+id|famid)/How to I tell
which is appropriate for my data set/Have I formatted that section of the
command properly?
2. Does anyone understand the error/how to fix it?
Many thanks
[[alternative HTML version deleted]]
More information about the R-help
mailing list