Learn R Programming

CepReg (version 0.1.3)

rrr_get: Reduced-Rank Regression on Cepstral Coefficients

Description

Fits a reduced-rank regression (RRR) between covariates and cepstral coefficients using a specified maximum rank, and reconstructs log-spectra.

Usage

rrr_get(X, f, frq, nbase, nrank)

Value

A list containing:

alph

Estimated intercept vector.

bet

Estimated coefficient matrix.

spechat

Estimated log-spectra.

res

Matrix of residuals.

Arguments

X

A numeric matrix of predictors (N x P).

f

A numeric matrix of cepstral coefficients.

frq

A vector of frequencies in [0,1].

nbase

Number of Fourier basis functions.

nrank

Fixed Rank for the reduced-rank regression.

Examples

Run this code
set.seed(123)
frq <- seq(0, 1, length.out = 16)[2:8]
n <- 5
p <- 2
nbase <- 2

X <- matrix(rnorm(n * p), n, p)

true_beta <- matrix(rnorm(p * nbase), p, nbase)
alph <- rnorm(nbase)
f <- X %*% true_beta + matrix(alph, n, nbase, byrow = TRUE) +
     matrix(rnorm(n * nbase), n, nbase)

rrr <- rrr_get(X, f, frq, nbase = nbase, nrank = 1)

Run the code above in your browser using DataLab