Learn R Programming

idem (version 5.2)

imImpSingle: Impute missing data for MCMC convergence checking

Description

Call STAN model to impute missing data for an individual subject under benchmark assumption for MCMC convergence checking

Usage

imImpSingle(
  dsub,
  fit.rst,
  normal = TRUE,
  chains = 4,
  iter = 5000,
  warmup = 1000,
  control = list(adapt_delta = 0.95),
  ...,
  seed = NULL
)

Value

NULL if there is no missing data in dsub

Otherwise, return a class IDEMSINGLE object that contains a list with components

dsub

original data of the subject

rst.stan

A stan.fit class result returned from rstan::sampling

complete

A dataframe with complete data for the selected subject

Arguments

dsub

original individual subject data

fit.rst

A class IDEMFIT results generated by imFitModel.

normal

Logical variable indicating whether normality assumption should be made for the residuals

chains

STAN parameter. Number of Markov chainsm

iter

STAN parameter. Number of iterations

warmup

STAN parameter. Number of burnin.

control

STAN parameter. See rstan::stan for details.

...

other options to call STAN sampling such as thin, algorithm. See rstan::sampling for details.

seed

Random seed

Examples

Run this code
im.abc <- imData(abc, trt="TRT", surv="SURV", outcome=c("Y1","Y2"),
                 y0=NULL, endfml="Y2",
                 trt.label = c("UC+SBT", "SAT+SBT"),
                 cov=c("AGE"), duration=365, bounds=c(0,100));
im.fit <- imFitModel(im.abc);
im.imp <- imImpSingle(abc[1,], im.fit, chains = 4, iter = 200, warmup = 100);

Run the code above in your browser using DataLab