bcaci: Bias-Corrected and Accelerated Confidence Intervals

Description Usage Arguments Author(s) See Also Examples

View source: R/ci.R

Description

Bias-Corrected and Accelerated Confidence Intervals

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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{α} \hat{β} \frac{σ_x}{σ_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.

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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
)
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
)

jeksterslabds/jeksterslabRmedsimple documentation built on Oct. 16, 2020, 11:30 a.m.