Generating by inverting function
On Sun, Sep 30, 2012 at 10:51 AM, Salma Wafi <salmawafi76 at yahoo.com> wrote:
Dear All, Thank you very much for your kind and response. Actually, S(t) = exp(b* F(t)) represent one of survival models, where F(t) is known cumulative distribtion function. So, that is why I need to generate the survival times T based on this model. Then for generating time I have to invert S(t) as following, Since, S(t) has uniform distribution on (0,1) so we can write that U= exp(b*F(t)), where U is uniform (0,1). Now to generat the time t, we do log(U)= b* F(t) (log(U))/ b = F(t) and then t = F((log(U))/b)^(-1). Now in case F(t) is cdf of Lognormal distribution or Weibull distribution My Question is how we can get the inverse of the cumulative distribution F(t) in R?. Is there any package in R can help to invert some function especially if this function is pdf or cdf?.
I repeat myself: if you have fit F() to a log-normal or Weibull distribution, just use qlnorm() or qweibull() included in base R. If you still need to fit those distributions, use MASS::fitdistr. Cheers, Michael
Thanks in advance.
[[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.