Learn R Programming

idem (version 2.2)

imImpSingle: Impute missing data under benchmark assumption

Description

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

Usage

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

Arguments

dsub

original individual subject data

fit.rst

A class IDEM.FIT results of linear regression. See 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.

Value

NULL if there is no missing data for the current subject.

Otherwise, return a class IDEM.IMPSUB that contains a list with two 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

Examples

Run this code
# NOT RUN {
lst.var <- list(trt="TRT", surv="SURV", outcome=c("Y1","Y2"), y0=NULL,
                endp=c("Y2"), unitTime="days",
                trt.label = c("UC+SBT", "SAT+SBT"),
                cov=c("AGE"), endfml="Y2", duration=365, bounds=c(0,100));
rst.fit <- imFitModel(abc, lst.var);
rst.imp <- imImpSingle(abc[1,], rst.fit, chains = 4, iter = 2000, warmup = 1000);
rstan::traceplot(rst.imp$rst.stan, "YMIS");

# }

Run the code above in your browser using DataLab