env_get: Envelope Estimator for Log-Spectral Regression

View source: R/cepstral.R

env_getR Documentation

Envelope Estimator for Log-Spectral Regression

Description

Fits an envelope regression model to predict cepstral coefficients from covariates.

Usage

env_get(X, f, frq, nbase)

Arguments

X

A numeric matrix of predictors (N × p).

f

A numeric matrix of cepstral coefficients (N × nbase).

frq

Numeric vector of frequencies in [0,1].

nbase

Number of Fourier basis functions.

Value

A list containing:

alph

Intercept vector.

bet

Envelope regression coefficient matrix.

spechat

Estimated smoothed log-spectra.

res

Residuals from envelope model.

Examples

library(Renvlp)

set.seed(123)
frq <- seq(0, 1, length.out = 16)[2:8]
n <- 20
p <- 3
nbase <- 5
X <- matrix(rnorm(n * p), n, p)
f <- matrix(rnorm(n * nbase), n, nbase)

u_max <- min(ncol(X), ncol(f))
cv_errors <- numeric(u_max)
for (j in 1:u_max) {
  cv_errors[j] <- cv.xenv(X, f, j, m = 5, nperm = 50)
}
optimal_u <- which.min(cv_errors)

env_result <- env_get(X, f, frq, nbase = nbase)

CepReg documentation built on Sept. 10, 2025, 10:38 a.m.

Related to env_get in CepReg...