bdlim4 {bdlim}R Documentation

Fit the BDLIM model with all 4 patterns of modification

Description

Fit the BDLIM model with all 4 patterns of modification

Usage

bdlim4(
  y,
  exposure,
  covars,
  group,
  id = NULL,
  df,
  nits,
  nburn = round(nits/2),
  nthin = 1,
  parallel = FALSE,
  family = "gaussian"
)

Arguments

y

A vector of outcomes

exposure

A matrix of exposures with one row for each individual

covars

A matrix or data.frame of covariates This should not include the grouping factor (see group below). This may include factor variables.

group

A vector of group memberships. This should be a factor variable.

id

An optional vector of individual IDs if there are repeated measures or other groupings that a random intercept should be included for. This must be a factor variable.

df

Degrees of freedom for the weight functions

nits

Number of MCMC iterations.

nburn

Number of MCMC iterations to be discarded as burn in. The default is half if the MCMC iterations. This is only used for WAIC in this function but is passed to summary and plot functions and used there.

nthin

Thinning factors for the MCMC. This is only used for WAIC in this function but is passed to summary and plot functions and used there.

parallel

Logical to use parallel computing for 4 models. If TRUE then the min of 4 and number of cores available will be used.

family

Family of model to be used. Supported options are "gaussian" for a normal/Gaussian linear model and "binomial" for a logistic model.

Value

A list of results from each different pattern of modification and model compassion metrics

Examples



# run BDLIM with modification by ChildSex
fit_sex <- bdlim4(
  y = sbd_bdlim$bwgaz,
  exposure = sbd_bdlim[,paste0("pm25_",1:37)],
  covars = sbd_bdlim[,c("MomPriorBMI","MomAge","race","Hispanic",
                                   "EstMonthConcept","EstYearConcept")],
  group = as.factor(sbd_bdlim$ChildSex),
  df = 5,
  nits = 5000,
  parallel = FALSE
)

# show model comparison results
fit_sex

#summarize results
sfit_sex <- summary(fit_sex)
sfit_sex
# graph the estimated distributed lag functions for each group
plot(sfit_sex)



[Package bdlim version 0.4.2 Index]