Learn R Programming

dcce (version 0.4.2)

bootstrap: Bootstrap Inference for DCCE Models

Description

Computes bootstrap standard errors and confidence intervals for dcce_fit objects using either cross-section or wild bootstrap.

Usage

bootstrap(
  object,
  type = c("crosssection", "wild"),
  reps = 500L,
  percentile = TRUE,
  cfresiduals = FALSE,
  seed = NULL
)

Value

An object of class dcce_boot with elements:

se_boot

Bootstrap standard errors.

ci_lower

Percentile CI lower bound (if percentile=TRUE).

ci_upper

Percentile CI upper bound.

b_boot

B x K matrix of bootstrap coefficient draws.

reps

Number of repetitions.

type

Bootstrap type.

Arguments

object

A dcce_fit object.

type

Character: "crosssection" (default) or "wild".

reps

Integer: number of bootstrap repetitions. Default 500.

percentile

Logical: compute percentile CIs? Default TRUE.

cfresiduals

Logical: for wild bootstrap, use common-factor residuals instead of defactored residuals? Default FALSE.

seed

Integer: random seed for reproducibility. Default NULL.

Examples

Run this code
set.seed(42)
df <- data.frame(
  id = rep(1:10, each = 30),
  t  = rep(1:30, 10),
  y  = rnorm(300),
  x  = rnorm(300)
)
fit <- dcce(df, "id", "t", y ~ x, model = "mg", cross_section_vars = NULL)
boot_res <- bootstrap(fit, reps = 50)
print(boot_res)

Run the code above in your browser using DataLab