Description Usage Arguments Value Examples
This function calculates a pair of measures, R-Squared and L-Squared, for parametric survival regression models. R-squared is an extension of the classical R2 statistic for a linear model, quantifying the amount of variability in the response that is explained by a corrected prediction based on the original prediction function. L-squared is the proportion of the prediction error of the original prediction function that is explained by the corrected prediction function, quantifying the distance between the corrected and uncorrected predictions. When used together, they give a complete summary of the predictive power of a prediction function.
1 | pam.survreg(fit.survreg)
|
fit.survreg |
object inheriting from class survreg representing a fitted parametric survival regression model. Specifying x = TRUE and y=TRUE are required in the call to survreg( ) to include the design matrix and the response vector in the object fit. |
A list containing two components: R-squared and L-squared
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | library(survival)
library(PAmeasures)
# Use Mayo Clinic Primary Biliary Cirrhosis Data
data(pbc)
head(pbc)
# Fit an exponential model with bilirubin
fit1 <- survreg(Surv(time, status==2) ~ bili, data = pbc,dist="exponential",x=TRUE,y=TRUE)
# R.squared and L.squared of exponential model
pam.survreg(fit1)
# Fit a lognormal model with standardised blood clotting time
fit2 <- survreg(Surv(time, status==2) ~ protime, data = pbc,dist="lognormal",x=TRUE,y=TRUE)
# R.squared and L.squared of lognormal model
pam.survreg(fit2)
# Fit a weibull model with bilirubin and standardised blood clotting time
fit3 <- survreg(Surv(time, status==2) ~ bili + protime, data = pbc,dist="weibull",x=TRUE,y=TRUE)
# R.squared and L.squared of weibull model
pam.survreg(fit3)
|
id time status trt age sex ascites hepato spiders edema bili chol
1 1 400 2 1 58.76523 f 1 1 1 1.0 14.5 261
2 2 4500 0 1 56.44627 f 0 1 1 0.0 1.1 302
3 3 1012 2 1 70.07255 m 0 0 0 0.5 1.4 176
4 4 1925 2 1 54.74059 f 0 1 1 0.5 1.8 244
5 5 1504 1 2 38.10541 f 0 1 1 0.0 3.4 279
6 6 2503 2 2 66.25873 f 0 1 0 0.0 0.8 248
albumin copper alk.phos ast trig platelet protime stage
1 2.60 156 1718.0 137.95 172 190 12.2 4
2 4.14 54 7394.8 113.52 88 221 10.6 3
3 3.48 210 516.0 96.10 55 151 12.0 4
4 2.54 64 6121.8 60.63 92 183 10.3 4
5 3.53 143 671.0 113.15 72 136 10.9 3
6 3.98 50 944.0 93.00 63 NA 11.0 3
$R.squared
[1] "NA"
$L.squared
[1] "NA"
Warning message:
In delta/km.censoring.minus :
longer object length is not a multiple of shorter object length
$R.squared
[1] "NA"
$L.squared
[1] "NA"
Warning message:
In delta/km.censoring.minus :
longer object length is not a multiple of shorter object length
$R.squared
[1] "NA"
$L.squared
[1] "NA"
Warning message:
In delta/km.censoring.minus :
longer object length is not a multiple of shorter object length
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.