Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

stackMI

Bayesian Model Fitting and Stacking for Multiple Imputation


Description

Runs an rmsb package Bayesian fitting function such as blrm separately for each completed dataset given a multiple imputation result such as one produced by Hmisc::aregImpute. Stacks the posterior draws and diagnostics across all imputations, and computes parameter summaries on the stacked posterior draws.

Usage

stackMI(
  formula,
  fitter,
  xtrans,
  data,
  n.impute = xtrans$n.impute,
  dtrans,
  derived,
  subset,
  refresh = 0,
  progress = if (refresh > 0) "stan-progress.txt" else "",
  ...
)

Arguments

formula

a model formula

fitter

a Bayesian fitter

xtrans

an object created by transcan, aregImpute, or mice

data

data frame

n.impute

number of imputations to run, default is the number saved in xtrans

dtrans

see Hmisc::fit.mult.impute

derived

see Hmisc::fit.mult.impute

subset

an integer or logical vector specifying the subset of observations to fit

refresh

see rstan::sampling. The default is 0, indicating that no progress notes are output. If refresh > 0 and progress is not '', progress output will be appended to file progress. The default file name is 'stan-progress.txt'.

progress

see refresh. Defaults to '' if refresh = 0. Note: If running interactively but not under RStudio, rstan will open a browser window for monitoring progress.

...

arguments passed to fitter

Value

an rmsb fit object with expanded posterior draws and diagnostics

Author(s)

Frank Harrell


rmsb

Bayesian Regression Modeling Strategies

v0.0.2
GPL (>= 3)
Authors
Frank Harrell [aut, cre] (<https://orcid.org/0000-0002-8271-5493>), Ben Goodrich [ctb] (contributed Stan code), Ben Bolker [ctb] (wrote original code that is folded into the pdensityContour function), Doug Bates [ctb] (write original code for highest posterior density interval that is folded into the HPDint function)
Initial release
2021-02-27

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.