all_inds: Form indicator matrix describing all submodels of a general...

Description Usage Arguments Value Examples

Description

Form indicator matrix describing all possible submodels of a general linear wide model, where the submodels are defined by selected covariates.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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 terms(wide) returns information about the terms of the model formula. Models outside standard R packages may not support this.

inds0

Narrow model indicators, in format described in fic.

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 c("(Intercept)"), and for Cox regression this is omitted.

...

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 rth 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

1
2
3
4
5
6
7
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))

fic documentation built on May 1, 2019, 7:55 p.m.