Package 'sufficientForecasting'

Title: Sufficient Forecasting using Factor Models
Description: The sufficient forecasting (SF) method is implemented by this package for a single time series forecasting using many predictors and a possibly nonlinear forecasting function. Assuming that the predictors are driven by some latent factors, the SF first conducts factor analysis and then performs sufficient dimension reduction on the estimated factors to derive predictive indices for forecasting. The package implements several dimension reduction approaches, including principal components (PC), sliced inverse regression (SIR), and directional regression (DR). Methods for dimension reduction are as described in: Fan, J., Xue, L. and Yao, J. (2017) <doi:10.1016/j.jeconom.2017.08.009>, Luo, W., Xue, L., Yao, J. and Yu, X. (2022) <doi:10.1093/biomet/asab037> and Yu, X., Yao, J. and Xue, L. (2022) <doi:10.1080/07350015.2020.1813589>.
Authors: Jianqing Fan [aut], Jing Fu [aut, cre], Wei Luo [aut], Lingzhou Xue [aut], Jiawei Yao [aut], Xiufan Yu [aut]
Maintainer: Jing Fu <[email protected]>
License: GPL (>= 3)
Version: 0.1.0
Built: 2025-02-03 04:24:03 UTC
Source: https://github.com/jingfu1224/sufficientforecasting

Help Index


A simulated dataset

Description

This is a simulated dataset consisting of predictors, responses, and additional predictors to make forecasting at a future time. In this example, the dimension of predictors is p=100, and the number of observed time periods is T=100.

Usage

dataExample

Format

  • dataExample$X simulated predictors; a p by T matrix

  • dataExample$y simulated responses; a T by 1 vector

  • dataExample$newX simulated new predictors for forecasting; a p by 1 vector


Estimate the number of common factors K

Description

Estimate the number of common factors K

Usage

getK(y, X, Kmax = 12)

Arguments

y

Response, T by 1 vector

X

Predictors, p by T matrix

Kmax

A prescribed upper bound that possibly increases with p and T (default = 12)

Value

Estimate of K

References

Bai, J., and Ng, S. (2002), Determining the number of factors in approximate factor models, Econometrica 70(1), 191-221.

Li, H., Li, Q. and Shi, Y. (2017), Determining the number of factors when the number of factors can increase with sample size, Journal of Econometrics 197(1), 76–86.


Select a method from PC, SIR and DR to do point prediction

Description

Select a method from PC, SIR and DR to do point prediction

Usage

SF(
  y,
  X,
  newX = NULL,
  K = "default",
  L = 1,
  method = "SIR.LM",
  hyperparameter = list()
)

Arguments

y

Response, T by 1 matrix

X

Predictors, p by T matrix

newX

New predictors, a vector contains p entries (or NULL)

K

The number of common factors (default = obtained by getK)

L

The number of predictive indices, L is required to be no greater than K (default = 1)

method

Select one from PC, SIR.LM, SIR.LLM and DR to do point prediction (default = SIR.LM)

hyperparameter

A list of parameters for the corresponding method

For SIR.LM and SIR.LLM:

arguments discretization and nslices. See SF.SIR for detail

For DR:

arguments etaopg and nslices. See SF.DR for detail

Value

Out-of-sample forecast for newX; or in-sample forecast for the last observed data point if newX is NULL

References

Fan, J., Xue, L. and Yao, J. (2017), Sufficient forecasting using factor models, Journal of econometrics 201(2), 292–306

Luo, W., Xue, L., Yao, J. and Yu, X. (2022), Inverse moment methods for sufficient forecasting using high-dimensional predictors, Biometrika 109(2), 473–487.

Yu, X., Yao, J. and Xue, L. (2022), Nonparametric estimation and conformal inference of the sufficient forecasting with a diverging number of factors, Journal of Business & Economic Statistics 40(1), 342–354.

Examples

utils::data(dataExample,package = "sufficientForecasting")
SF(dataExample$y,dataExample$X,method = "SIR.LLM",
hyperparameter = list(nslices = 5,discretization = TRUE))
SF(dataExample$y,dataExample$X,dataExample$newX,method = "DR")
SF(dataExample$y,dataExample$X,dataExample$newX,method = "PC")

Conformal inference of the sufficient forecasting

Description

Conformal inference of the sufficient forecasting

Usage

SF.CI(
  y,
  X,
  newX = NULL,
  type = "LM",
  K = "default",
  L = 1,
  alpha = 0.1,
  discretization = TRUE,
  nslices = 10
)

Arguments

y

Response, T by 1 matrix

X

Predictors, p by T matrix

newX

New predictors, a vector contains p entries (or NULL)

type

LM or LLM (default = LM)

K

The number of common factors (default = obtained by getK)

L

The number of predictive indices, L is required to be no greater than K (default = 1)

alpha

Mis-coverage rate

discretization

Hyperparameter in SIR (default = TRUE)

nslices

Hyperparameter in SIR (default = 10)

Value

A list with components

yhat

Out-of-sample forecast for newX; or in-sample forecast for the last observed data point if newX is NULL

ci_lower

Lower bound of conformal interval

ci_upper

Upper bound of conformal interval

References

Yu, X., Yao, J. and Xue, L. (2022), Nonparametric estimation and conformal inference of the sufficient forecasting with a diverging number of factors, Journal of Business & Economic Statistics 40(1), 342–354.

Examples

utils::data(dataExample,package = "sufficientForecasting")
SF.CI(dataExample$y,dataExample$X,type = "LM",alpha = 0.05)

Directional regression for sufficient forecasting

Description

Directional regression for sufficient forecasting

Usage

SF.DR(y, X, newX = NULL, K = "default", L = 1, etaopg = "default", nslices = 3)

Arguments

y

Response, T by 1 matrix

X

Predictors, p by T matrix

newX

New predictors, a vector contains p entries (or NULL)

K

The number of common factors (default = obtained by getK)

L

The number of predictive indices, L is required to be no greater than K (default = 1)

etaopg

hyperparameter in DR (default = obtained by opg)

nslices

hyperparameter in DR (default = 3)

Value

Out-of-sample forecast for newX; or in-sample forecast for the last observed data point if newX is NULL

References

Luo, W., Xue, L., Yao, J. and Yu, X. (2022), Inverse moment methods for sufficient forecasting using high-dimensional predictors, Biometrika 109(2), 473–487.

Examples

utils::data(dataExample,package = "sufficientForecasting")
SF.DR(dataExample$y,dataExample$X,dataExample$newX)

Principal component regression for sufficient forecasting

Description

Principal component regression for sufficient forecasting

Usage

SF.PC(y, X, newX = NULL, K = "default", L = "default")

Arguments

y

Response, T by 1 matrix

X

Predictors, p by T matrix

newX

New predictors, a vector contains p entries (or NULL)

K

The number of common factors (default = obtained by getK)

L

The number of principal components used in the prediction, L is required to be no greater than K (default = K)

Value

Out-of-sample forecast for newX; or in-sample forecast for the last observed data point if newX is NULL

Examples

utils::data(dataExample,package = "sufficientForecasting")
SF.PC(dataExample$y,dataExample$X)

Sliced inverse regression for sufficient forecasting

Description

Sliced inverse regression for sufficient forecasting

Usage

SF.SIR(
  y,
  X,
  newX = NULL,
  type = "LM",
  K = "default",
  L = 1,
  discretization = TRUE,
  nslices = 10
)

Arguments

y

Response, T by 1 matrix

X

Predictors, p by T matrix

newX

New predictors, a vector contains p entries (or NULL)

type

LM or LLM (default = LM), type = LM fits a linear regression of the response on the estimated predictive indices; type = LLM fits a local linear regression

K

The number of common factors (default = obtained by getK)

L

The number of predictive indices, L is required to be no greater than K (default = 1)

discretization

Hyperparameter in SIR (default = TRUE)

nslices

Hyperparameter in SIR (default = 10)

Value

Out-of-sample forecast for newX; or in-sample forecast for the last observed data point if newX is NULL

References

Fan, J., Xue, L. and Yao, J. (2017), Sufficient forecasting using factor models, Journal of econometrics 201(2), 292–306.

Yu, X., Yao, J. and Xue, L. (2022), Nonparametric estimation and conformal inference of the sufficient forecasting with a diverging number of factors, Journal of Business & Economic Statistics 40(1), 342–354.

Examples

utils::data(dataExample,package = "sufficientForecasting")
SF.SIR(dataExample$y,dataExample$X,type = "LLM")