enw_effects_metadata: Extracts metadata from a design matrix

View source: R/model-design-tools.R

enw_effects_metadataR Documentation

Extracts metadata from a design matrix

Description

This function extracts metadata from a design matrix and returns a data.table with the following columns:

  • effects: the name of the effect

  • fixed: a logical indicating whether the effect is fixed (1) or random (0).

It automatically drops the intercept (defined as "(Intercept)").

This function is useful for constructing a model design object for random effects when used in combination with ewn_add_pooling_effect.

Usage

enw_effects_metadata(design)

Arguments

design

A design matrix as returned by stats::model.matrix().

Value

A data.table with the following columns:

  • effects: the name of the effect

  • fixed: a logical indicating whether the effect is fixed (1) or random (0)

See Also

Functions used to formulate models enw_add_cumulative_membership(), enw_add_pooling_effect(), enw_design(), enw_one_hot_encode_feature()

Examples

data <- data.frame(a = 1:3, b = as.character(1:3), c = c(1,1,2))
design <- enw_design(a ~ b + c, data)$design
enw_effects_metadata(design)

seabbs/epinowcast documentation built on Aug. 28, 2024, 12:31 p.m.