Article View: aus.stats.s
Article #245Simulation of the Frailty of the Cox PH model
From: Mohammad Ehsanul Karim
Date: Sun, 08 Apr 2007 07:39
Date: Sun, 08 Apr 2007 07:39
56 lines
2836 bytes
2836 bytes
Dear Group,
I am trying to do simulation of survival data to enable it to run
under frailty option. Below is the function a that I am using. My
questions are:
1. How do I modify it to get bigger (hopefully significant) value of
Variance of random effect?
2. What changes do I have to make in the function to run it under
correlated frailty model? (may be in kinship package)
3. Is there any program to run frailty by Inverse gaussian or stable
family in S-plus or R?
Thank you for your time.
Thanks in advance.
Mohammad Ehsanul Karim
wildscop at yahoo dot com
Institute of Statistical Research and Training
University of Dhaka
# ***************************************
"sim.data"<- function(g,m){
set.seed(123)
group <- rep(1:m,rep(g,m))
Frailty <- rep(rgamma(m,100,1),rep(g,m))
covariate <- rbinom(g*m,1,.05)
stimes <- rweibull(g*m,1.1,1/(5*Frailty*exp((covariate)/.5)))
cens <- 5 + 5*runif(25)
times <- pmin(stimes, cens)
censored <- as.numeric(cens > times)
data.mat <- cbind(group,covariate,times,censored,Frailty)
data.mat <- data.mat[rev(order(times)),1:length(data.mat[1,])]
data.fr <- data.frame(data.mat)
return(data.fr)
}
# ***************************************
# Example of 50 group each with 100 members
sim.fr<-sim.data(50,100)
# library(survival) # to run in R
fit.c <- coxph(Surv(times,censored) ~ covariate,data= sim.fr)
# fit.c gives the Usual cox proportional hazards model
fit.gm.em <- coxph(Surv(times,censored) ~ covariate + frailty(group,
dist='gamma', method='em'), data= sim.fr)
# fit.gm.em gives the gamma frailty model by EM algorithm
fit.c # result of Cox PH model
fit.gm.em # result of gamma frailty model
Technical Details
Message-ID:
<1176017943.264702.109110@n76g2000hsh.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!n76g2000hsh.googlegroups.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: fa931,5ae335e6da28042b,start X-Google-Attributes: gidfa931,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!n76g2000hsh.googlegroups.com!not-for-mail From: "Mohammad Ehsanul Karim" <wildscop@yahoo.com> Newsgroups: aus.stats.s Subject: Simulation of the Frailty of the Cox PH model Date: 8 Apr 2007 00:39:03 -0700 Organization: http://groups.google.com Lines: 57 Message-ID: <1176017943.264702.109110@n76g2000hsh.googlegroups.com> NNTP-Posting-Host: 203.112.196.86 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1176017943 24016 127.0.0.1 (8 Apr 2007 07:39:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 8 Apr 2007 07:39:03 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.0 gw03.univdhaka.edu:3128 (squid/2.5.STABLE6) Complaints-To: groups-abuse@google.com Injection-Info: n76g2000hsh.googlegroups.com; posting-host=203.112.196.86; posting-account=uuQLsw0AAABQcPMmXDo_67uRtU7KSph-