env_get | R Documentation |
Fits an envelope regression model to predict cepstral coefficients from covariates.
env_get(X, f, frq, nbase)
X |
A numeric matrix of predictors (N × p). |
f |
A numeric matrix of cepstral coefficients (N × nbase). |
frq |
Numeric vector of frequencies in |
nbase |
Number of Fourier basis functions. |
A list containing:
alph
Intercept vector.
bet
Envelope regression coefficient matrix.
spechat
Estimated smoothed log-spectra.
res
Residuals from envelope model.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.