Description Usage Arguments Value See Also Examples
Core FIC calculation functions underlying the user interface in fic
.
fic_core
just handles one submodel, while fic_multi
can assess multiple submodels of the same wide model. For fic_multi
, inds
and parsub
can be matrices with one row per submodel, while for fic_core
they must be vectors.
1 2 3 4 5 |
par |
Vector of maximum likelihood estimates from the wide model |
J |
Information matrix from the wide model, evaluated at the maximum likelihood estimates (note that this definition differs from Claeskens and Hjort, where |
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 |
n |
Number of observations in the data used to fit the wide model. |
focus_deriv |
Vector of partial derivatives of the focus function with respect to the parameters in the wide model. This is required by If there are multiple submodels, this should be a matrix with number of rows equal to the number of submodels, and number of columns equal to the number of parameters in the wide model. If there is a single submodel, this should be a vector with number of columns equal to the number of parameters in the wide model. This should take the value given by |
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 |
wt |
Vector of weights to apply to different covariate values in |
parsub |
Vector of maximum likelihood estimates from the submodel, or a matrix if there are multiple submodels. Only required to return the estimate of the focus quantity alongside the model assessment statistics for the submodel. If omitted, the estimate is omitted. |
auxpar |
Estimates of auxiliary parameters from the wide model. The only built-in example is the dispersion parameter for GLMs. |
auxsub |
List of estimates of auxiliary parameters from the submodel. The only built-in example is the dispersion parameter for GLMs. |
... |
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 |
See fic
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Lower-level implementation of the example in the main vignette
wide.glm <- glm(low ~ lwtkg + age + smoke + ht + ui + smokeage + smokeui,
data=birthwt, family=binomial)
mod1.glm <- glm(low ~ lwtkg + age + smoke, data=birthwt, family=binomial)
inds0 <- c(1,1,0,0,0,0,0,0)
inds1 <- c(1,1,1,1,0,0,0,0)
focus_plogis <- function(par, X)plogis(X %*% par)
vals.smoke <- c(1, 58.24, 22.95, 1, 0, 0, 22.95, 0)
vals.nonsmoke <- c(1, 59.50, 23.43, 0, 0, 0, 0, 0)
X <- rbind(vals.smoke, vals.nonsmoke)
par <- coef(wide.glm)
n <- nrow(birthwt)
J <- solve(vcov(wide.glm))
fic_multi(par=par, J=J, inds=inds1, inds0=inds0, n=n, focus="prob_logistic",
X=X, parsub=c(coef(mod1.glm), 0, 0, 0, 0))
## Even lower-level implementation, requiring derivatives of the focus
## These are available analytically in this example, but would normally
## need to be calculated using numerical differentiation
focus_deriv <- prob_logistic_deriv(par=par, X=X)
fic_core(par=par, J=J, inds=inds1, inds0=inds0, gamma0=0, n=n,
focus_deriv=focus_deriv)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.