fic.survreg {fic} | R Documentation |
Focused information criteria for parametric survival models
Description
Focused information criteria for parametric survival models fitted with the survival package.
Usage
## S3 method for class 'survreg'
fic(wide, inds, inds0 = NULL, gamma0 = 0, focus = NULL,
focus_deriv = NULL, wt = NULL, sub = NULL, B = 0, loss = loss_mse,
...)
Arguments
wide |
Object returned by the |
inds |
Matrix or vector of indicators for which parameters are included in the submodel or submodels to be assessed. A matrix should be supplied if there are multiple submodels. This should have number of rows equal to the number of submodels, and number of columns equal to the total number of parameters in the wide model. It contains 1s in the positions where the parameter is included in the submodel, and 0s in positions where the parameter is excluded. This should always be 1 in the positions defining the narrow model, as specified in |
inds0 |
Vector of indicators specifying the narrow model, in the same format as |
gamma0 |
Vector of special values taken by the parameters This defaults to 0, as in covariate selection, where "excluded" coefficients are fixed to 0. This should either be a scalar, assumed to be the same for all parameters fixed in the narrow model, or a vector of length equal to the number of parameters from the wide model which are fixed in the narrow model, that is, the number of entries of |
focus |
An R function with:
The function should return the focus quantity of interest. If additional arguments are supplied which are vectors or matrices, e.g. Not required if Alternatively,
See |
focus_deriv |
Vector of partial derivatives of the focus function with respect to the parameters in the wide model. This is not usually needed, as it can generally be computed automatically and accurately from the function supplied in |
wt |
Vector of weights to apply to different covariate values in |
sub |
List of fitted model objects of class |
B |
If |
loss |
A function returning an estimated loss for a submodel estimate under the sampling distribution of the wide model. Only applicable when using bootstrapping. This should have two arguments |
... |
Other arguments to the focus function can be supplied here. The built-in focus functions If just one focus is needed, then To compute focused model comparison statistics for multiple focuses defined by the same focus function evaluated at multiple covariate values, For a typical regression model, the first parameter will denote an intercept, so the first value of Arguments to the focus function other than |
Details
Any situation where all models being compared are special cases of a single "wide" model are supported. Examples include covariate selection, selection between models for the baseline hazard/survival with different levels of flexibility (e.g. comparing exponential and Weibull). An example of the latter is in the fic package vignette "Examples of focused model comparison: parametric survival models".
Parameters par
of the focus function should be on the scale reported by the icoef
component of the results of survreg
, that is, with any positive-valued parameters log transformed.
Examples
library(survival)
## Fit exponential and Weibull models and plot fitted survival curves
ex <- survreg(Surv(futime, fustat) ~ 1, data=ovarian, dist="exponential")
we <- survreg(Surv(futime, fustat) ~ 1, data=ovarian, dist="weibull")
## Plot fitted survival curves, highlighting 1 year survival
plot(survfit(Surv(futime, fustat) ~ 1, data=ovarian))
t <- seq(0, 1200)
lines(t, pweibull(q=t, shape=exp(we$icoef[2]),
scale=exp(we$icoef[1]), lower.tail=FALSE))
lines(t, pexp(q=t, rate=1/exp(ex$icoef[1]), lower.tail=FALSE), lty=2)
abline(v=365, col="gray")
## Focused model comparison for focus of 1-year survival probability
indmat <- rbind(exp = c(1,0),
weib = c(1,1))
surv1yr <- function(par){
pweibull(q=365, shape=exp(par[2]), scale=exp(par[1]), lower.tail=FALSE)
}
fic(we, inds=indmat, focus=surv1yr, sub=list(ex, we))
## Exponential model has lower expected error, given such a small dataset