On Sat, Sep 29, 2012 at 6:23 PM, Salma Wafi <salmawaf...@yahoo.com> wrote:
> Hello,
> I am trying to generate random survival times by inverting the function,  
> S(t)= exp(b*F(t)), where b is constant and F(t) is some cumulative 
> distribution function, let say that F(t) is cdf of normal distribution or any 
> others distributions.
>
> as we know that 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).
>
> My Question  is how we can get the inverse function for 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?.

If F is a standard distribution, the q*** functions are what you are
likely looking for. If F is an empirical fit, you'll have to roll your
own but it's not hard. Take a look at the ?ecdf function for some
inspiration.

Michael

>
> Thanks in advance.
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
> 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.
>

______________________________________________
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