nmfkc.ar.degree.cv: Optimize lag order for the autoregressive model

View source: R/nmfkc.ar.R

nmfkc.ar.degree.cvR Documentation

Optimize lag order for the autoregressive model

Description

nmfkc.ar.degree.cv selects the optimal lag order for an autoregressive model by applying cross-validation over candidate degrees.

This function accepts both standard matrices (Variables x Time) and ts objects (Time x Variables). ts objects are automatically transposed internally.

Usage

nmfkc.ar.degree.cv(
  Y,
  rank = 1,
  degree = 1:2,
  intercept = TRUE,
  plot = TRUE,
  ...
)

Arguments

Y

Observation matrix Y(P,N) or a ts object.

rank

Rank of the basis matrix. For backward compatibility, Q is accepted via ....

degree

A vector of candidate lag orders to be evaluated.

intercept

Logical. If TRUE (default), an intercept is added to the covariate matrix.

plot

Logical. If TRUE (default), a plot of the objective function values is drawn.

...

Additional arguments passed to nmfkc.cv.

Value

A list with components:

degree

The lag order that minimizes the cross-validation objective function.

degree.max

Maximum recommended lag order, computed as 10 \log_{10}(N) following the ar function in the stats package.

objfunc

Objective function values for each candidate lag order.

See Also

nmfkc.ar, nmfkc.cv

Examples

# Example using ts object directly
d <- AirPassengers

# Selection of degree (using ts object)
# Note: Y is automatically transposed if it is a ts object
nmfkc.ar.degree.cv(Y=d, rank=1, degree=11:14)

nmfkc documentation built on July 14, 2026, 1:07 a.m.