Description Usage Arguments Details Examples
Focused information criteria for multi-state models fitted with msm
from the msm package.
1 2 3 4 |
wide |
Object returned by |
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 gamma which define the narrow model. 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 objects returned by |
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 |
This might be used for covariate selection, or comparing models with different constraints on the covariate effects or intensities. An example is given in the fic package vignette "Examples of focused model comparison: multi-state models". Note in particular in this example how the parameters are ordered in the inds
argument, and how the various msm output functions can be used as focuses.
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 26 27 28 29 30 | ## Covariate selection in psoriatic arthritis model.
## See the "fic" package vignette on multi-state models for
## more details and examples.
if (requireNamespace("msm",quietly=TRUE)){
Qind <- rbind(c(0, 1, 0, 0),
c(0, 0, 1, 0),
c(0, 0, 0, 1),
c(0, 0, 0, 0))
psor.wide.msm <- msm::msm(state ~ months, subject=ptnum, data=msm::psor,
qmatrix = Qind, gen.inits=TRUE,
covariates = ~ollwsdrt+hieffusn)
inds <- rbind(
c(1,1,1,0,0,0,0,0,0),
c(1,1,1,0,0,0,0,0,1),
c(1,1,1,0,0,0,0,1,1),
c(1,1,1,0,0,0,1,1,1),
c(1,1,1,0,0,1,1,1,1),
c(1,1,1,0,1,1,1,1,1),
c(1,1,1,1,1,1,1,1,1)
)
focus_tlos <- function(par){
x.new <- msm::updatepars.msm(psor.wide.msm, par)
msm::totlos.msm(x.new, covariates=0, tot=10)["State 4"]
}
fres <- fic(wide=psor.wide.msm, inds=inds, focus=focus_tlos)
fres
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.