# survreg.distributions

##### Parametric Survival Distributions

List of distributions for accelerated failure models. These are location-scale families for some transformation of time. The entry describes the cdf \(F\) and density \(f\) of a canonical member of the family.

- Keywords
- survival

##### Usage

`survreg.distributions`

##### Details

There are four basic distributions:`extreme`

, `gaussian`

,
`logistic`

and `t`

. The last three
are parametrised in the same way as the distributions already present in
R. The extreme value cdf is
$$F=1-e^{-e^t}.$$

When the logarithm of survival time has one of the first three distributions
we obtain respectively `weibull`

, `lognormal`

, and
`loglogistic`

. The location-scale parameterization of a Weibull
distribution found in `survreg`

is not the same as the parameterization
of `rweibull`

.

The other predefined distributions are defined in terms of these. The
`exponential`

and `rayleigh`

distributions are Weibull
distributions with fixed `scale`

of 1 and 0.5 respectively, and
`loggaussian`

is a synonym for `lognormal`

.

For speed parts of the three most commonly used distributions
are hardcoded in C; for this reason the elements of `survreg.distributions`

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 `survreg.distributions`

a new distribution can be specified as a separate list.
This is the preferred method of addition and is illustrated below.

##### Format

There are two basic formats, the first defines a distribution de novo, the second defines a new distribution in terms of an old one.

name: | name of distribution |

variance: | function(parms) returning the variance (currently unused) |

init(x,weights,...): | Function returning an initial |

estimate of the mean and variance | |

(used for initial values in the iteration) | |

density(x,parms): | Function returning a matrix with columns \(F\), \(1-F\), \(f\), \(f'/f\), and \(f''/f\) |

quantile(p,parms): | Quantile function |

scale: | Optional fixed value for the scale parameter |

parms: | Vector of default values and names for any additional parameters |

deviance(y,scale,parms): | Function returning the deviance for a |

and to define one distribution in terms of another

name: | name of distribution |

dist: | name of parent distribution |

trans: | transformation (eg log) |

dtrans: | derivative of transformation |

itrans: | inverse of transformation |

scale: | Optional fixed value for scale parameter |

##### See Also

##### Examples

```
# NOT RUN {
# 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)
# }
```

*Documentation reproduced from package survival, version 3.1-8, License: LGPL (>= 2)*