> 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@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.

Reply via email to