| sandwich_from_whitened_resid | R Documentation |
GLS standard errors from whitened residuals
sandwich_from_whitened_resid(
Xw,
Yw,
beta = NULL,
type = c("iid", "hc0"),
df_mode = c("rankX", "n-p"),
runs = NULL
)
Xw |
Whitened design matrix. |
Yw |
Whitened data matrix (time x voxels). |
beta |
Optional coefficients (p x v); estimated if |
type |
Either "iid" (default) or "hc0" for a robust sandwich. |
df_mode |
Degrees-of-freedom mode: "rankX" (default) or "n-p". |
runs |
Optional run labels (reserved for future per-run scaling). |
List containing standard errors, innovation variances, and XtX inverse.
# Generate example whitened data
n_time <- 200
n_pred <- 3
n_voxels <- 50
Xw <- matrix(rnorm(n_time * n_pred), n_time, n_pred)
Yw <- matrix(rnorm(n_time * n_voxels), n_time, n_voxels)
# Compute standard errors
se_result <- sandwich_from_whitened_resid(Xw, Yw, type = "iid")
# Extract standard errors for first voxel
se_voxel1 <- se_result$se[, 1]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.