create_modelset: Create matrix selecting covariates in models

Description Usage Arguments Details Value Examples

View source: R/create_modelset.R

Description

Function create_modelset creates a matrix indicating covariates (fixed effects) in each model considered by the user

Usage

1
2
3
4
5
create_modelset(
  modelset = c("all_subsets", "nested", "part_subset"),
  common = NULL,
  p = 5
)

Arguments

modelset

Type of model set:

  • "all_subsets" - all possible models using all covariates

  • "nested" - a sequence of nested models using all covariates

  • "part_subset" - all possible models using a subset of covariates

common

A vector indicating variables forced to be present in each model. Default: NULL

p

Number of all covariates under consideration (intercept included). Default: 5

Details

modelset = "nested"

The first model contains one covariate from the first column of X, then two covariates from the first and the second column of X, etc.

common

A vector of length at most p, consisting of those column numbers of X for which the covariates are forced to be present in every model (e.g. c(2,5) for variables 2 and 5). If provided, it is used in model.set = "partsubsets".

Value

modelset_matrix

Matrix composed of zeros and ones. Ones correspond to covariates in a model which is represented in nth row.

Examples

1
2
3
4
5
6
7
8
9
# "all_subsets"
modelset  = create_modelset("all_subsets", p = 5)

# "nested"
modelset  = create_modelset("nested", p = 5)

# "part_subset"
modelset  = create_modelset("part_subset", p = 5,
                             common = c(1:3))

KatarzynaReluga/postcAIC documentation built on Jan. 25, 2022, 12:33 a.m.