Re: [R] Hazard function or cumulative Hazard function in R

2005-03-22 Thread Göran Broström
On Mon, Mar 21, 2005 at 04:04:50PM -0800, Spencer Graves wrote:
1.  Have you looked at the survival package?  Venables and Ripley 
 (2002) Modern Applied Statistics with S (Springer) has a chapter on 
 survival analysis that I found quite helpful.  The survival package 
 includes hazard plots, which are discussed in Venables and Ripley. 

It seems more likely that Yassir wants to calculate theoretical hazard and
cumulative hazards functions (as he knows how to program it) for a given
distribution, and then the answer is 'No there are no such functions'.

But, taking the Weibull distribution as an example, they are easily
calculated using 'pweibull' and 'dweibull':

1. From ?pweibull:

   The cumulative hazard H(t) = - log(1 - F(t)) is 
   '-pweibull(t, a, b, lower = FALSE, log = TRUE)'

2. The hazard function hweibull itself can be given by
   
   hweibull - function(t, shape, scale = 1) dweibull(t, shape, scale) /
   pweibull(t, shape, scale, lower.tail = FALSE)  

'hweibull', as defined here, is not the numerically optimal solution, but
the formula has the advantage of working for any distribution.

  2.  If that is not adequate, have you tried an R Site Search 
 (from www.r-project.org - search)? 
 
  hope this helps.  spencer graves
 
 yassir rabhi wrote:
 
   Hi, 
 I'm student from canada, and i'work in survival
 analysis.I want to know if there is a hazard function
 or cumulative hazard function in R or not, i know how
 to program it, but it is easy to use it if they exists
 in R.
 Thanks.
  Yassir
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
  
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html

-- 
 Göran Broströmtel: +46 90 786 5223
 Department of Statistics  fax: +46 90 786 6614
 Umeå University   http://www.stat.umu.se/egna/gb/
 SE-90187 Umeå, Sweden e-mail: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Hazard function or cumulative Hazard function in R

2005-03-21 Thread yassir rabhi
   Hi, 
 I'm student from canada, and i'work in survival
analysis.I want to know if there is a hazard function
or cumulative hazard function in R or not, i know how
to program it, but it is easy to use it if they exists
in R.
Thanks.
  Yassir

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Hazard function or cumulative Hazard function in R

2005-03-21 Thread Kjetil Brinchmann Halvorsen
yassir rabhi wrote:
  Hi, 
I'm student from canada, and i'work in survival
analysis.I want to know if there is a hazard function
or cumulative hazard function in R or not, i know how
to program it, but it is easy to use it if they exists
in R.
Thanks.
 Yassir

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

 

library(survival)
--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Hazard function or cumulative Hazard function in R

2005-03-21 Thread Spencer Graves
   1.  Have you looked at the survival package?  Venables and Ripley 
(2002) Modern Applied Statistics with S (Springer) has a chapter on 
survival analysis that I found quite helpful.  The survival package 
includes hazard plots, which are discussed in Venables and Ripley. 

 2.  If that is not adequate, have you tried an R Site Search 
(from www.r-project.org - search)? 

 hope this helps.  spencer graves
yassir rabhi wrote:
  Hi, 
I'm student from canada, and i'work in survival
analysis.I want to know if there is a hazard function
or cumulative hazard function in R or not, i know how
to program it, but it is easy to use it if they exists
in R.
Thanks.
 Yassir

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html