Learn R Programming

refund (version 0.1-40)

gam_sandwich_cluster_cl2: Cluster-robust CL2 sandwich covariance estimator

Description

Computes a cluster-robust covariance matrix with a Bell-McCaffrey style leverage adjustment (`CL2` in this package), clustering by curve.

Usage

gam_sandwich_cluster_cl2(
  b,
  cluster_id,
  freq = FALSE,
  tol = 1e-08,
  leverage_cap = 0.999
)

Value

A p x p covariance matrix.

Arguments

b

Fitted GAM object (must not have class `"pffr"`).

cluster_id

Integer vector mapping each vectorized observation to a curve.

freq

If `TRUE`, use frequentist sandwich (`B2 = 0`). If `FALSE` (default), use Bayesian sandwich (`B2 = Vp - Ve`).

tol

Eigenvalue floor for numerical stability.

leverage_cap

Cap for cluster leverage eigenvalues (< 1).