all_inds.default {fic} | R Documentation |
Form indicator matrix describing all submodels of a general linear wide model
Description
Form indicator matrix describing all possible submodels of a general linear wide model, where the submodels are defined by selected covariates.
Usage
## Default S3 method:
all_inds(wide, inds0 = NULL, auxpars = NULL, ...)
all_inds(wide, inds0, ...)
## S3 method for class 'lm'
all_inds(wide, inds0, ...)
## S3 method for class 'glm'
all_inds(wide, inds0, ...)
## S3 method for class 'coxph'
all_inds(wide, inds0, ...)
Arguments
wide |
A fitted model of standard R format, such that |
inds0 |
Narrow model indicators, in format described in |
auxpars |
Names of parameters in the wide model other than the covariate effects being selected from. By default, for linear and generalised linear models this is |
... |
Other arguments. Currently unused. |
Value
A matrix in the format required by the inds
argument of fic()
, representing all possible submodels of the wide model.
The number of rows is the number of models, and the number of columns is the number of parameters in the wide model. The r,s
entry of the matrix is a 1 if the r
th submodel includes parameter s
, and 0 otherwise.
If a factor is included (excluded) from the submodel, then all corresponding parameters are included (excluded).
See the package vignettes for examples.
Examples
bwt.glm <- glm(low ~ lwtkg + age + smoke, data=birthwt, family="binomial")
all_inds(bwt.glm, inds0=c(1,0,0,0))
# note no intercept term in Cox models, so inds0 has two elements here
library(survival)
wide <- coxph(Surv(years, death==1) ~ sex + thick_centred, data=melanoma)
all_inds(wide, inds0=c(0,0))