Learn R Programming

CICI (version 0.9.7)

make.model.formulas: Compose appropriate model formulas

Description

Function that generates generic model formulas for Y-/L-/A- and Cnodes, according to time ordering and to be used in gformula or model.formulas.update.

Usage

make.model.formulas(X, Ynodes = NULL, Lnodes = NULL, Cnodes = NULL, Anodes = NULL,
                    survival = FALSE, evaluate = FALSE)

Value

Returns a named list:

model.names

A list of length 4 containing strings of the actual formulas

fitted.models

A list of the fitted models (if evaluate=TRUE)

fitted.model.summary

A list of the summary of the fitted models (if evaluate=TRUE)

Arguments

X

A data frame, following the time-ordering of the nodes.

Ynodes

A character string of column names in X of the outcome variable(s).

Lnodes

A character string of column names in X of time-dependent (post first treatment) variable(s).

Cnodes

A character string of column names in X of the censoring variable(s).

Anodes

A character string of column names in X of intervention variable(s).

survival

Logical. If TRUE, a survival setting is assumed and taken into account for model specification.

evaluate

Logical. TRUE if model formulas should model formulas be evaluated on X.

Details

This is a helper function to generate model formulas for Y-/L-/A- and Cnodes, according to the time ordering: i.e. to generate GLM/GAM model formulas for the respective nodes given all past variables. In survival settings, past censoring and outcome nodes are omitted from the formulae. If censoring is present without a survival setting (e.g. Cnodes describe drop-outs and Y is a continuous outcome), then survival should be set as FALSE.

See Also

The generated generic model formulas can be updated manually with model.update or in an automated manner with screening using model.formulas.update.

Examples

Run this code
data(EFV)

m <- make.model.formulas(X=EFV,
                         Lnodes  = c("adherence.1","weight.1",
                                     "adherence.2","weight.2",
                                     "adherence.3","weight.3",
                                     "adherence.4","weight.4"
                                    ),
                         Ynodes  = c("VL.0","VL.1","VL.2","VL.3","VL.4"),
                         Anodes  = c("efv.0","efv.1","efv.2","efv.3","efv.4"),
                         evaluate=FALSE) # set TRUE to see fitted models
                         
m$model.names # all models potentially relevant for gformula(), given full past

Run the code above in your browser using DataLab