Re: [R] Weibull maximum likelihood estimates for censored data

From: Terry Therneau <therneau_at_mayo.edu>
Date: Wed, 09 Apr 2008 08:15:29 -0500 (CDT)


> I have a matrix with data and a column indicating whether it is censored
> or not. Is there a way to apply weibull and exponential maximum
> likelihood estimation directly on the censored data, like in the paper:
> Backtesting Value-at-Risk: A Duration-Based Approach, P Chrisoffersen
> and D Pelletier (October 2003) page 8?

 It would be easier to use the survreg function, which is part of the survival library. It will fit MLE estimates of the exponential, Weibull, log-normal, and others.  

 >library(survival)
 > survreg(Surv(D, C) ~1, data=Interest)

 Coefficients:
(Intercept)

   5.531319

Scale= 1.303637

Loglik(model)= -12.3 Loglik(intercept only)= -12.3  

 Notes:

  1. The survreg function uses a location/scale parameterization of the Weibull. Kalbfleisch and Prentice, "The statistical analysis of failure time data" is the standard text for this. There are several others. A simple online reference is a technical report from earlier versions of the survival package, TR #53 available at www.mayo.edu/biostatistics. (Somewhat dated wrt newer options in the package, but sufficient for your purposes).
  2. You give page numbers but no journal name in your reference.
  3. I don't know whether your variable "C" has 1=censored or 1=uncensored. The survreg function expects the latter. You can just change the call to survreg(Surv(D, 1-C) ~1) if yours is otherwise.
  4. The rest of your message is a set of nested functions with hardly a single comment. It is very difficult for an outside reader to comment on "what went wrong" without further hints about what it is that you are actually trying to compute.

           Terry Therneau



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. Received on Wed 09 Apr 2008 - 13:21:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 10 Apr 2008 - 21:30:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive