EVOLUTION-MANAGER
Edit File: survreg.distributions.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Parametric Survival Distributions</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for survreg.distributions {survival}"><tr><td>survreg.distributions {survival}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Parametric Survival Distributions</h2> <h3>Description</h3> <p> List of distributions for accelerated failure models. These are location-scale families for some transformation of time. The entry describes the cdf <i>F</i> and density <i>f</i> of a canonical member of the family. </p> <h3>Usage</h3> <pre> survreg.distributions </pre> <h3>Format</h3> <p>There are two basic formats, the first defines a distribution de novo, the second defines a new distribution in terms of an old one. </p> <table summary="Rd table"> <tr> <td style="text-align: left;"> name:</td><td style="text-align: left;"> name of distribution</td> </tr> <tr> <td style="text-align: left;"> variance:</td><td style="text-align: left;"> function(parms) returning the variance (currently unused)</td> </tr> <tr> <td style="text-align: left;"> init(x,weights,...):</td><td style="text-align: left;"> Function returning an initial</td> </tr> <tr> <td style="text-align: left;"> </td><td style="text-align: left;"> estimate of the mean and variance </td> </tr> <tr> <td style="text-align: left;"> </td><td style="text-align: left;"> (used for initial values in the iteration)</td> </tr> <tr> <td style="text-align: left;"> density(x,parms):</td><td style="text-align: left;"> Function returning a matrix with columns <i>F</i>, <i>1-F</i>, <i>f</i>, <i>f'/f</i>, and <i>f''/f</i></td> </tr> <tr> <td style="text-align: left;"> quantile(p,parms):</td><td style="text-align: left;"> Quantile function</td> </tr> <tr> <td style="text-align: left;"> scale:</td><td style="text-align: left;"> Optional fixed value for the scale parameter</td> </tr> <tr> <td style="text-align: left;"> parms:</td><td style="text-align: left;"> Vector of default values and names for any additional parameters</td> </tr> <tr> <td style="text-align: left;"> deviance(y,scale,parms):</td><td style="text-align: left;"> Function returning the deviance for a</td> </tr> <tr> <td style="text-align: left;"> </td><td style="text-align: left;"> saturated model; used only for deviance residuals. </td> </tr> </table> <p>and to define one distribution in terms of another </p> <table summary="Rd table"> <tr> <td style="text-align: left;"> name:</td><td style="text-align: left;"> name of distribution</td> </tr> <tr> <td style="text-align: left;"> dist:</td><td style="text-align: left;"> name of parent distribution</td> </tr> <tr> <td style="text-align: left;"> trans:</td><td style="text-align: left;"> transformation (eg log)</td> </tr> <tr> <td style="text-align: left;"> dtrans:</td><td style="text-align: left;"> derivative of transformation</td> </tr> <tr> <td style="text-align: left;"> itrans:</td><td style="text-align: left;"> inverse of transformation</td> </tr> <tr> <td style="text-align: left;"> scale:</td><td style="text-align: left;"> Optional fixed value for scale parameter</td> </tr> <tr> <td style="text-align: left;"> </td> </tr> </table> <h3>Details</h3> <p>There are four basic distributions:<code>extreme</code>, <code>gaussian</code>, <code>logistic</code> and <code>t</code>. The last three are parametrised in the same way as the distributions already present in <span style="font-family: Courier New, Courier; color: #666666;"><b>R</b></span>. The extreme value cdf is </p> <p style="text-align: center;"><i>F=1-e^{-e^t}.</i></p> <p>When the logarithm of survival time has one of the first three distributions we obtain respectively <code>weibull</code>, <code>lognormal</code>, and <code>loglogistic</code>. The location-scale parameterization of a Weibull distribution found in <code>survreg</code> is not the same as the parameterization of <code><a href="../../stats/html/Weibull.html">rweibull</a></code>. </p> <p>The other predefined distributions are defined in terms of these. The <code>exponential</code> and <code>rayleigh</code> distributions are Weibull distributions with fixed <code>scale</code> of 1 and 0.5 respectively, and <code>loggaussian</code> is a synonym for <code>lognormal</code>. </p> <p>For speed parts of the three most commonly used distributions are hardcoded in C; for this reason the elements of <code>survreg.distributions</code> with names of "Extreme value", "Logistic" and "Gaussian" should not be modified. (The order of these in the list is not important, recognition is by name.) As an alternative to modifying <code>survreg.distributions</code> a new distribution can be specified as a separate list. This is the preferred method of addition and is illustrated below. </p> <h3>See Also</h3> <p><code><a href="survreg.html">survreg</a></code>, <code><a href="../../stats/html/Weibull.html">pweibull</a></code>, <code><a href="../../stats/html/Normal.html">pnorm</a></code>,<code><a href="../../stats/html/Logistic.html">plogis</a></code>, <code><a href="../../stats/html/TDist.html">pt</a></code>, <code><a href="survregDtest.html">survregDtest</a></code> </p> <h3>Examples</h3> <pre> # time transformation survreg(Surv(time, status) ~ ph.ecog + sex, dist='weibull', data=lung) # change the transformation to work in years # intercept changes by log(365), everything else stays the same my.weibull <- survreg.distributions$weibull my.weibull$trans <- function(y) log(y/365) my.weibull$itrans <- function(y) 365*exp(y) survreg(Surv(time, status) ~ ph.ecog + sex, lung, dist=my.weibull) # Weibull parametrisation y<-rweibull(1000, shape=2, scale=5) survreg(Surv(y)~1, dist="weibull") # survreg scale parameter maps to 1/shape, linear predictor to log(scale) # Cauchy fit mycauchy <- list(name='Cauchy', init= function(x, weights, ...) c(median(x), mad(x)), density= function(x, parms) { temp <- 1/(1 + x^2) cbind(.5 + atan(x)/pi, .5+ atan(-x)/pi, temp/pi, -2 *x*temp, 2*temp*(4*x^2*temp -1)) }, quantile= function(p, parms) tan((p-.5)*pi), deviance= function(...) stop('deviance residuals not defined') ) survreg(Surv(log(time), status) ~ ph.ecog + sex, lung, dist=mycauchy) </pre> <hr /><div style="text-align: center;">[Package <em>survival</em> version 2.44-1.1 <a href="00Index.html">Index</a>]</div> </body></html>