% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bootstrap.R
\name{bootstrap}
\alias{bootstrap}
\title{Bootstrap Inference for DCCE Models}
\usage{
bootstrap(
  object,
  type = c("crosssection", "wild"),
  reps = 500L,
  percentile = TRUE,
  cfresiduals = FALSE,
  seed = NULL
)
}
\arguments{
\item{object}{A \code{dcce_fit} object.}

\item{type}{Character: \code{"crosssection"} (default) or \code{"wild"}.}

\item{reps}{Integer: number of bootstrap repetitions. Default 500.}

\item{percentile}{Logical: compute percentile CIs? Default \code{TRUE}.}

\item{cfresiduals}{Logical: for wild bootstrap, use common-factor
residuals instead of defactored residuals? Default \code{FALSE}.}

\item{seed}{Integer: random seed for reproducibility. Default \code{NULL}.}
}
\value{
An object of class \code{dcce_boot} with elements:
\describe{
\item{se_boot}{Bootstrap standard errors.}
\item{ci_lower}{Percentile CI lower bound (if \code{percentile=TRUE}).}
\item{ci_upper}{Percentile CI upper bound.}
\item{b_boot}{B x K matrix of bootstrap coefficient draws.}
\item{reps}{Number of repetitions.}
\item{type}{Bootstrap type.}
}
}
\description{
Computes bootstrap standard errors and confidence intervals for
\code{dcce_fit} objects using either cross-section or wild bootstrap.
}
\note{
\strong{Naming conflict with \code{broom::bootstrap}.} The \code{broom} package
also exports a function called \code{bootstrap()} (for resampling data
frames), with a completely different signature. If you load
\code{broom} after \code{dcce}, \code{broom::bootstrap} will mask \code{dcce::bootstrap}
on the search path and calls to \code{bootstrap(fit, type = ..., reps = ...)}
will fail with an "unused arguments" error. To avoid the conflict
you can either (a) use the namespace prefix
\code{dcce::bootstrap(fit, ...)}, (b) load \code{broom} \strong{before} \code{dcce} so
\code{dcce} ends up higher in the search path, or (c) use the
conflict-free alias \code{dcce_bootstrap(fit, ...)} which is exported by
\code{dcce} and has the same semantics.
}
\examples{
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)

}
