gestboot {gesttools} | R Documentation |
Percentile Based Bootstrap Confidence Intervals
Description
Generates percentile based confidence intervals for the causal parameters of a fitted SNMM. Bonferroni corrected confidence intervals are also reported for multiple comparisons.
Usage
gestboot(
gestfunc,
data,
idvar,
timevar,
Yn,
An,
Cn,
outcomemodels,
propensitymodel,
censoringmodel = NULL,
type,
EfmVar = NA,
cutoff,
bn,
alpha = 0.05,
onesided = "twosided",
seed = NULL,
...
)
Arguments
gestfunc |
Name (without quotations) of the g-estimation function to run.
One of |
data , idvar , timevar , Yn , An , Cn , outcomemodels , propensitymodel , censoringmodel , type , EfmVar , cutoff |
Same arguments as in gest functions, to be input into gestfunc. |
bn |
Number of bootstrapped datasets. |
alpha |
Confidence level of confidence intervals. |
onesided |
Controls the type of confidence interval generated. Takes one of three inputs, |
seed |
Integer specifying the random seed for generation of bootstrap samples. |
... |
additional arguments. |
Value
Returns a list of the following four elements.
original |
The value of the causal parameters estimated on the original data |
mean.boot |
The average values of the causal parameters estimated on the bootstrapped datasets. |
conf |
The upper and/or lower bounds of |
conf.Bonferroni |
The upper and/or lower bounds of Bonferroni corrected confidence
intervals for |
boot.results |
A tibble containing the result for each bootstrapped dataset |
Examples
datas <- dataexamples(n = 1000, seed = 123, Censoring = FALSE)
data <- datas$datagest
data <- FormatData(
data = data, idvar = "id", timevar = "time", An = "A",
varying = c("A", "L"), GenerateHistory = TRUE, GenerateHistoryMax = 1
)
idvar <- "id"
timevar <- "time"
Yn <- "Y"
An <- "A"
Cn <- NA
outcomemodels <- list("Y~A+L+U+Lag1A", "Y~A+L+U+Lag1A", "Y~A+L+U+Lag1A")
propensitymodel <- c("A~L+U+as.factor(time)+Lag1A")
censoringmodel <- NULL
type <- 1
EfmVar <- NA
bn <- 5
alpha <- 0.05
gestfunc <- gestSingle
gestboot(gestfunc, data, idvar, timevar, Yn, An, Cn, outcomemodels, propensitymodel,
censoringmodel = NULL, type = 1, EfmVar,
bn = bn, alpha = alpha, onesided = "twosided", seed = 123
)