dot-rss_gau: Compute residual sum of squares from AD regression

.rss_gauR Documentation

Compute residual sum of squares from AD regression

Description

For time point i, regress Y_i on its p_i predecessors (Y_(i-1), ..., Y_(i-p_i)) and return the residual sum of squares.

Usage

.rss_gau(y, i, p, mu = NULL, include_intercept = TRUE)

Arguments

y

Numeric matrix n_subjects by n_time.

i

Time index (1-based).

p

Number of predecessors to include in regression (can be 0).

mu

Optional mean vector. If provided, data is centered by mu before regression. If NULL, regression includes an intercept.

include_intercept

Logical. If TRUE and mu is NULL, include intercept in regression.

Details

When mu is provided, the regression is: (Y_i - mu_i) ~ (Y_(i-1) - mu_(i-1)) + ... + (Y_(i-p) - mu_(i-p)) with no intercept.

When mu is NULL and include_intercept is TRUE: Y_i ~ 1 + Y_(i-1) + ... + Y_(i-p)

For i = 1 or p = 0, the RSS is simply the sum of squared deviations from the mean (or from mu_1 if provided).

Value

Residual sum of squares (scalar).


antedep documentation built on April 25, 2026, 1:06 a.m.