create.dm: Creates a design matrix for a parameter

View source: R/create.dm.R

create.dmR Documentation

Creates a design matrix for a parameter

Description

Creates a design matrix using the design dataframe, a formula and any intervals defined for time, cohort and age.

Usage

create.dm(x, formula, time.bins=NULL, cohort.bins=NULL, age.bins=NULL, 
                  chunk_size=1e7, remove.intercept=NULL,remove.unused.columns=TRUE)
       
       create.dml(ddl,model.parameters,design.parameters,restrict=FALSE,
             chunk_size=1e7,use.admb=FALSE,remove.unused.columns=TRUE,simplify=FALSE)

Arguments

x

design dataframe created by create.dmdf

formula

formula for model in R format

time.bins

any bins of time to collapse values

cohort.bins

any bins of cohort to collapse values

age.bins

any bins of cohort to collapse values

chunk_size

specifies amount of memory to use in creating design matrices; amount used is 8*chunk_size/1e6 MB (default 80MB)

remove.intercept

if TRUE, forces removal of intercept in design matrix

remove.unused.columns

if TRUE, unused columns are removed; otherwise they are left

ddl

Design data list which contains a list element for each parameter type; if NULL it is created

design.parameters

Specification of any grouping variables for design data for each parameter

model.parameters

List of model parameter specifications

restrict

if TRUE, only use design data with Time >= Cohort

use.admb

if TRUE uses mixed.model.admb for random effects; otherwise mixed.model

simplify

if TRUE simplies real parameter structure for some models; at this time it is not more efficient so ignore

Value

create.dm returns a fixed effect design matrix constructed with the design dataframe and the formula for a single parametre. It excludes any columns that are all 0. create.dml returns a list with an element for for each parameter with a sub-list for the fixed effect (fe) and random effects. The re structure depends on switch use.admb. When TRUE, it contains a single design matrix (re.dm) and indices for random effects (re.indices). When FALSE, it returns re.list which is a list with an element for each random component containing re.dm and indices for that random effect (eg (1|id) + (1|time) would produce elements for id and time.

Author(s)

Jeff Laake


marked documentation built on Oct. 19, 2023, 5:06 p.m.