Bias-Corrected and Accelerated Confidence Intervals

bcaci(
  thetahatstar,
  thetahatstarjack = NULL,
  thetahat,
  theta = NULL,
  data,
  std = FALSE,
  complete = TRUE,
  alpha = c(0.001, 0.01, 0.05),
  par = TRUE,
  ncores = NULL,
  blas_threads = TRUE,
  mc = TRUE,
  lb = FALSE
)

Arguments

thetahatstar

Numeric vector. Sampling distribution of thetahat.

thetahatstarjack

Numeric vector. Jackknife vector of parameter estimates. If thetahatstarjack = NULL, thetahatstarjack is calculated using jack().

thetahat

Numeric. Parameter estimate.

theta

Numeric. Parameter. Optional argument.

data

n by 3 matrix or data frame. data[, 1] correspond to values for x. data[, 2] correspond to values for m. data[, 3] correspond to values for y.

std

Logical. Standardize the indirect effect \(\hat{\alpha} \hat{\beta} \frac{\sigma_x}{\sigma_y}\).

complete

Logical. If TRUE, create complete data set before bootstrapping. If 'FALSE`' bootstrap incomplete data set and fit the model with FIML.

alpha

Numeric vector. Alpha level. By default alpha = c(0.001, 0.01, 0.05).

par

Logical. If TRUE, use multiple cores. If FALSE, use lapply().

ncores

Integer. Number of cores to use if par = TRUE. If unspecified, defaults to detectCores() - 1.

blas_threads

Logical. If TRUE, set BLAS threads using blas_set_num_threads(threads = blas_get_num_procs()). If FALSE, set BLAS threads using blas_set_num_threads(threads = 1). If par = TRUE, blas_threads is automatically set to FALSE to prevent conflicts in parallel processing. This argument is useful when FUN can handle implicit parallelism when par = FALSE, for example linear algebra operations.

mc

Logical. If TRUE, use parallel::mclapply(). If FALSE, use parallel::parLapply() or parallel::parLapplyLB(). Ignored if par = FALSE.

lb

Logical. If TRUE use parallel::parLapplyLB(). If FALSE, use parallel::parLapply(). Ignored if par = FALSE and mc = TRUE.

See also

Other confidence intervals functions: bcci(), evalci(), len(), pcci(), shape(), theta_hit(), zero_hit()

Author

Ivan Jacob Agaloos Pesigan

Examples

B <- 5000 data <- jeksterslabRdatarepo::thirst n <- nrow(data) muthetahat <- colMeans(data) Sigmathetahat <- cov(data) thetahat <- fit.ols(data, minimal = TRUE) thetahatstar <- pb.mvn( muthetahat = muthetahat, Sigmathetahat = Sigmathetahat, n = n, B = 5000, par = FALSE ) bcaci( thetahatstar = thetahatstar, thetahat = thetahat, theta = 0.15, # assuming that the true indirect effect is 0.15 data = data, par = FALSE )
#> est se reps ci_0.05 ci_0.5 #> 1.527185e-01 7.733199e-02 5.000000e+03 -2.433815e-02 7.725781e-03 #> ci_2.5 ci_97.5 ci_99.5 ci_99.95 zero_hit_99.9 #> 3.826733e-02 3.513996e-01 4.127810e-01 5.210673e-01 1.000000e+00 #> zero_hit_99 zero_hit_95 len_99.9 len_99 len_95 #> 0.000000e+00 0.000000e+00 5.454055e-01 4.050552e-01 3.131323e-01 #> shape_99.9 shape_99 shape_95 theta_hit_99.9 theta_hit_99 #> 2.080401e+00 1.793624e+00 1.735947e+00 1.000000e+00 1.000000e+00 #> theta_hit_95 theta_miss_99.9 theta_miss_99 theta_miss_95 theta #> 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.500000e-01
thetahat <- fit.ols(data, minimal = TRUE, std = TRUE) thetahatstar <- pb.mvn( muthetahat = muthetahat, Sigmathetahat = Sigmathetahat, n = n, std = TRUE, B = 5000, par = FALSE ) bcaci( thetahatstar = thetahatstar, thetahat = thetahat, theta = 0.15, # assuming that the true indirect effect is 0.15 data = data, std = TRUE, par = FALSE )
#> est se reps ci_0.05 ci_0.5 #> 0.15303271 0.07212713 5000.00000000 -0.01705917 0.01281978 #> ci_2.5 ci_97.5 ci_99.5 ci_99.95 zero_hit_99.9 #> 0.04354391 0.33414392 0.39591032 0.45179941 1.00000000 #> zero_hit_99 zero_hit_95 len_99.9 len_99 len_95 #> 0.00000000 0.00000000 0.46885858 0.38309055 0.29060001 #> shape_99.9 shape_99 shape_95 theta_hit_99.9 theta_hit_99 #> 1.75650188 1.73220550 1.65415281 1.00000000 1.00000000 #> theta_hit_95 theta_miss_99.9 theta_miss_99 theta_miss_95 theta #> 1.00000000 0.00000000 0.00000000 0.00000000 0.15000000