If I run a Weibull survival model in R with the code
survreg(Surv(t,delta)~expalatory variables, dist="w")
how do I interpret the output of the model? That is, is the form of the model just $1-\exp(e/\lambda)^k)$ with $\lambda$ the scale and $k$ the shape or does it take a different form?
I have found something which says that the output is of the form $$\exp(-\exp(-\alpha_0-\alpha_1-\ldots)^kx^k),$$ where the $\alpha_i$ are the coefficients of the covariates. If so, the output would give me the following parameters:
$$k=k \quad \mbox{and} \quad \lambda=\frac{1}{\exp(-\alpha_0-\alpha_1\ldots)}.$$
Best Answer
Ok so I'm just going to post an answer here using the R help that DWin described. Using the function
rweibull
in R gives the usual form of the Weibull distribution, with its cumulative function being:$$F(x)=1-\exp(-\left ( \frac{x}{b}\right )^a)$$
So we will denote the shape parameter of
rweibull
by $a$ and the scale parameter ofrweibull
by $b$.Now the problem is that the output of
survreg
gives both shape and scale parameters which are not the same as the shape and scale parameters fromrweibull
. Let us denote the shape parameter fromsurvreg
as $a_s$ and the scale parameter ofsurvreg
by $b_s$.Then, from
?survreg
we have that:So this gives us that:
$$a=\frac{1}{b_s}\quad \mbox{and} \quad b=\exp(a_s)$$
So if we suppose that we run the function
survreg
with $n$ covariates, then the output will be:$\alpha_0,\ldots, \alpha_{n-1}$, the coefficents of the covariates and some scale parameter $k$. The Weibull model given in standard form is then given by:
$$F(x)=1-\exp\left (- \left (\frac{x}{\exp(\alpha_0+\alpha_1+\ldots +\alpha_{n-1})} \right ) ^{\frac{1}{k}}\right )$$