Hi Xin, to answer your question: say you have your regression
reg = coxph(...
Then you can assess the log likelihood by
reg$loglik
This vector contains typically two values, the null log likelihood of the
restricted model that excludes the fixed effects and the log likelihood of
the unrestricted model that includes the fixed effects. The latter is
certainly the value you want. It is the second in the vector provided by
reg$loglik.
To store them you could just create a vector and add the log likelihood
values to the vector. Something along the lines of:
logliks=numeric(90)
for(i in 1:90){
reg=coxph(... , data=aListOfYour90Datasets[[i]])
logliks[i]=reg$loglik[2]
}
HTH,
Daniel
-------------------------
cuncta stricte discussurus
-------------------------
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
Behalf Of Xin Ge
Sent: Monday, April 19, 2010 11:19 PM
To: r-help at r-project.org
Subject: [R] Help: coxph() in {survival} package
Hi All,
I'm runnning coxph() on 90 different datasets (in a loop).
1. I'm wondering how can I get "log-likelihood" value from coxph()
output.
Currently I can only see following:
Likelihood ratio test
Wald test
Score (logrank) test
2. Once I have likelihood value, I would like to extract these from R
output (for each data set).
Can any one help please, thanks in advance,
Xin
P.S. OR, may be if anyone can suggest me some other function which can help
me with this.
[[alternative HTML version deleted]]
______________________________________________
R-help at 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.