pred_fun_cov: Fit Covariate Models

View source: R/pred.R

pred_fun_covR Documentation

Fit Covariate Models

Description

This internal function fits a model for each covariate using the observed data.

Usage

pred_fun_cov(
  covparams,
  covnames,
  covtypes,
  covfits_custom,
  restrictions,
  time_name,
  obs_data,
  model_fits
)

Arguments

covparams

List of vectors, where each vector contains information for one parameter used in the modeling of the time-varying covariates (e.g., model statement, family, link function, etc.). Each vector must be the same length as covnames and in the same order.

covnames

Vector of character strings specifying the names of the time-varying covariates in obs_data.

covtypes

Vector of character strings specifying the "type" of each time-varying covariate included in covnames. The possible "types" are: "binary", "normal", "categorical", "bounded normal", "zero-inflated normal", "truncated normal", "absorbing", "categorical time", and "custom".

covfits_custom

Vector containing custom fit functions for time-varying covariates that do not fall within the pre-defined covariate types. It should be in the same order covnames. If a custom fit function is not required for a particular covariate (e.g., if the first covariate is of type "binary" but the second is of type "custom"), then that index should be set to NA.

restrictions

List of vectors. Each vector contains as its first entry a covariate for which a priori knowledge of its distribution is available; its second entry a condition under which no knowledge of its distribution is available and that must be TRUE for the distribution of that covariate given that condition to be estimated via a parametric model or other fitting procedure; its third entry a function for estimating the distribution of that covariate given the condition in the second entry is false such that a priori knowledge of the covariate distribution is available; and its fourth entry a value used by the function in the third entry. The default is NA.

time_name

Character string specifying the name of the time variable in obs_data.

obs_data

Data on which the models are fit.

model_fits

Logical scalar indicating whether to return the fitted models. The default is FALSE.

Value

A list of fitted models, one for each covariate in covnames.


gfoRmula documentation built on May 31, 2023, 9:46 p.m.