Movatterモバイル変換


[0]ホーム

URL:


Type:Package
Title:Robust Econometric Inference
Version:1.1.1
Description:Drawing statistical inference on the coefficients of a short- or long-horizon predictive regression with persistent regressors by using the IVX method of Magdalinos and Phillips (2009) <doi:10.1017/S0266466608090154> and Kostakis, Magdalinos and Stamatogiannis (2015) <doi:10.1093/rfs/hhu139>.
License:GPL-3
URL:https://github.com/kvasilopoulos/ivx
BugReports:https://github.com/kvasilopoulos/ivx/issues
Depends:R (≥ 3.1)
Imports:methods, Rcpp (≥ 0.12.18)
Suggests:covr (≥ 3.2.1), forecast (≥ 8.12), spelling (≥ 2.1),testthat (≥ 2.1.1), lmtest
Enhances:texreg
LinkingTo:Rcpp (≥ 1.0.1), RcppArmadillo (≥ 0.9.300.2.0)
Encoding:UTF-8
Language:en-US
LazyData:true
RoxygenNote:7.3.1
NeedsCompilation:yes
Packaged:2025-09-20 10:22:53 UTC; User
Author:Kostas Vasilopoulos [cre, aut], Efthymios Pavlidis [aut]
Maintainer:Kostas Vasilopoulos <k.vasilopoulo@gmail.com>
Repository:CRAN
Date/Publication:2025-09-20 10:40:02 UTC

Robust Econometric Inference

Description

Drawing statistical inference on the coefficients of a short- or long-horizonpredictive regression with persistent regressors by using the IVX method ofMagdalinos and Phillips (2009) DOI: 10.1017/S0266466608090154 andKostakis, Magdalinos and Stamatogiannis (2015) DOI: 10.1093/rfs/hhu139.

Author(s)

Maintainer: Kostas Vasilopoulosk.vasilopoulo@gmail.com

Authors:

See Also

Useful links:


Autocorrelation tests

Description

Autocorrelation tests

Usage

ac_test(x, lag_max = 5)

Arguments

x

the residuals or anivx object.

lag_max

the maximum length of lags.

Examples

obj <- ivx(hpi ~ cpi + def + int + log(res), data = ylpc)lmtest::bgtest(hpi ~ cpi + def + int + log(res), data = ylpc)ac_test(obj, 5)

Tests for autocorrelation

Description

Usage

ac_test_wald(x, lag)ac_test_lb(x, lag)ac_test_bp(x, lag)ac_test_bg(x, order, type, fill)

Arguments

x

anivx model or a⁠numeric vector⁠, usually the residuals from an ols regression.

lag

the number of lags.

order

lag TODO

type

the type of test statistic to be returned. Either "Chisq" forthe Chi-squared test statistic or "F" for the F test statistic.

fill

starting values for the lagged residuals in the auxiliary regression.By default 0 but can also be set to NA.

Details

If p-value < 0.051: You can reject the null hypothesis assuming a5% chance of making a mistake. So you can assume that your values are showingdependence on each other.

Value

a numeric scalar or numeric vector.

See Also

Box.testlmtest::bgtest

Examples

mdl <- ivx(hpi ~ cpi + inv, data = ylpc)ac_test_wald(mdl)ac_test(mdl)

Calculate the delta coefficient

Description

Computes the long-run correlation coefficient between the residuals of thepredictive regression and the autoregressive model for the regressor.

Usage

delta(object)

Arguments

object

on object of class "ivx"

Value

A vector of the estimated correlation coefficients. This should haverow and column names corresponding to the parameter names given by the coef method.

Examples

mod <- ivx(Ret ~ LTY, data = monthly)delta(mod)

extract method forivx objects

Description

extract method forivx objects

Usage

extract.ivx(  model,  include.wald = TRUE,  include.nobs = TRUE,  include.aic = FALSE,  include.bic = FALSE,  include.rsquared = FALSE,  include.adjrs = FALSE,  ...)extract.ivx_ar(  model,  include.wald = TRUE,  include.nobs = TRUE,  include.aic = FALSE,  include.bic = FALSE,  include.rsquared = FALSE,  include.adjrs = FALSE,  ...)

Arguments

model

A statistical model object.

include.wald

Report the Wald statistic.

include.nobs

Report the number of observations in the GOF block?

include.aic

Report Akaike's Information Criterion (AIC) in the GOFblock?

include.bic

Report the Bayesian Information Criterion (BIC) in the GOFblock?

include.rsquared

Report the R-squared.

include.adjrs

Report the Adjusted R-squared.

...

Custom parameters, which are handed over to subroutines. Currentlynot in use.


Fitting IVX Models

Description

ivx fits predictive regression models. The method allows standardchi-square testing for regressors with different degrees of persistence,from stationary to mildly explosive, and can be used for both short-and long-horizon predictive regressions.

Usage

ivx(  formula,  data,  horizon,  na.action,  weights,  contrasts = NULL,  offset,  model = TRUE,  x = FALSE,  y = FALSE,  ...)## S3 method for class 'ivx'print(x, digits = max(3L, getOption("digits") - 3L), ...)

Arguments

formula

an object of class "formula" (or one that can be coerced to that class):a symbolic description of the model to be fitted.

data

n optional data frame, list or environment (or object coercible byas.data.frame to a data frame) containingthe variables in the model. If not found in data, the variables are takenfrom environment(formula), typically the environment from which lm is called.

horizon

is the horizon (default horizon = 1 corresponds to ashort-horizon regression).

na.action

a function which indicates what should happen when the datacontain NAs. The default is set by the na.action setting ofoptions,and isna.fail if that is unset. The ‘factory-fresh’default isna.omit. Another possible value isNULL,no action. Valuena.exclude can be useful.

weights

an optional vector of weights to be used in the fitting process.Should beNULL or a numeric vector. If non-NULL, weighted least squares is usedwith weightsweights (that is, minimizingsum(w*e^2)); otherwise ordinaryleast squares is used.

contrasts

an optional list. See thecontrasts.arg ofmodel.matrix.default.

offset

this can be used to specify an a priori known component to beincluded in the linear predictor during fitting. This should be NULL or anumeric vector or matrix of extents matching those of the response. One ormore offset terms can be included in the formula instead or as well, and if morethan one are specified their sum is used. Seemodel.offset

model

logical. IfTRUE the model.frame of the fit is returned.

x

an object of class "ivx", usually, a result of a call to ivx.

y

logical. IfTRUE the response of the fit is returned.

...

additional arguments to be passed to the low level regression fittingfunctions (seelm).

digits

the number of significant digits to use when printing.

Value

an object of class "ivx".

References

Magdalinos, T., & Phillips, P. (2009). Limit Theory for CointegratedSystems with Moderately Integrated and Moderately Explosive Regressors.Econometric Theory, 25(2), 482-526.

Kostakis, A., Magdalinos, T., & Stamatogiannis, M. P. (2014).Robust econometric inference for stock return predictability. The Review ofFinancial Studies, 28(5), 1506-1553.

Examples

# Univariateivx(Ret ~ LTY, data = kms)# Multivariateivx(Ret ~ LTY + TBL, data = kms)# Longer horizonivx(Ret ~ LTY + TBL, data = kms, horizon = 4)wt <- runif(nrow(kms))ivx(Ret ~ LTY, data = kms, weights = wt)

Fitting IVX-AR Models

Description

ivx_ar implements the Yang et al (2020) new instrumental variable based Wald statistic(IVX-AR) which accounts for serial correlation and heteroscedasticity in the errorterms of the linear predictive regression model.

Usage

ivx_ar(  formula,  data,  horizon,  ar = "auto",  ar_ic = c("bic", "aic", "aicc"),  ar_max = 5,  ar_grid = function(x) seq(x - 0.3, x + 0.3, by = 0.02),  na.action,  contrasts = NULL,  offset,  model = TRUE,  x = FALSE,  y = FALSE,  ...)## S3 method for class 'ivx_ar'print(x, digits = max(3L, getOption("digits") - 3L), ...)

Arguments

formula

an object of class "formula" (or one that can be coerced to that class):a symbolic description of the model to be fitted.

data

n optional data frame, list or environment (or object coercible byas.data.frame to a data frame) containingthe variables in the model. If not found in data, the variables are takenfrom environment(formula), typically the environment from which lm is called.

horizon

is the horizon (default horizon = 1 corresponds to ashort-horizon regression).

ar

Method to include the autoregressive terms. "auto" find the optimalar order by using the information criteria.ar = 0 reduces to simpleivx.ar > 1 uses a fixed order to estimate the model.

ar_ic

Information criterion to be used in model selection.

ar_max

Maximum ar order of model to fit.

ar_grid

The ar grid sequence of which to iterate.

na.action

a function which indicates what should happen when the datacontain NAs. The default is set by the na.action setting ofoptions,and isna.fail if that is unset. The ‘factory-fresh’default isna.omit. Another possible value isNULL,no action. Valuena.exclude can be useful.

contrasts

an optional list. See thecontrasts.arg ofmodel.matrix.default.

offset

this can be used to specify an a priori known component to beincluded in the linear predictor during fitting. This should be NULL or anumeric vector or matrix of extents matching those of the response. One ormore offset terms can be included in the formula instead or as well, and if morethan one are specified their sum is used. Seemodel.offset

model

logical. IfTRUE the model.frame of the fit is returned.

x

an object of class "ivx_ar", usually, a result of a call to ivx_ar.

y

logical. IfTRUE the response of the fit is returned.

...

additional arguments to be passed to the low level regression fittingfunctions (seelm).

digits

the number of significant digits to use when printing.

References

Yang, B., Long, W., Peng, L., & Cai, Z. (2020). Testing thePredictability of US Housing Price Index Returns Based on an IVX-AR Model.Journal of the American Statistical Association, 1-22. DOI: 10.1080/01621459.2019.1686392

Examples

ivx_ar(hpi ~ log(res) + cpi, ylpc)ivx_ar(hpi ~ log(res) + cpi, ylpc, ar_ic = "aic")ivx_ar(hpi ~ log(res) + cpi, ylpc, ar = 1)

Fitter Functions for IVX-AR Models

Description

Basic function called byivx_ar to fit predictive models.These should only be used directly by experienced users.

Usage

ivx_ar_fit(  y,  x,  horizon = 1,  offset = NULL,  ar = "auto",  ar_max = 5,  ar_ic = "bic",  ar_grid = function(x) seq(x - 0.3, x + 0.3, by = 0.02),  ...)

Arguments

y

vector of observations of lengthn, or a matrix withn rows.

x

design matrix of dimensionn * p.

horizon

is the horizon (default horizon = 1 corresponds to ashort-horizon regression).

offset

(numeric of lengthn). This can be used tospecify ana priori known component to be included in thelinear predictor during fitting.

ar

Method to include the autoregressive terms. "auto" find the optimalar order by using the information criteria.ar = 0 reduces to simpleivx.ar > 1 uses a fixed order to estimate the model.

ar_max

Maximum ar order of model to fit.

ar_ic

Information criterion to be used in model selection.

ar_grid

The ar grid sequence of which to iterate.

...

Further arguments passed to the function which is fitting the best AR model.Ifar = "auto" then the internal functionauto_ar is used, ifar = "forecast" thenthe the functionforecast::auto.arima is used. If ar is of fixed length thenarima is used.

Examples

ivx_ar_fit(monthly$Ret, as.matrix(monthly$LTY))ivx_ar_fit(monthly$Ret, as.matrix(monthly$LTY), ar = 1)

Fitter Functions for IVX Models

Description

Basic function called byivx to fit predictive models.These should only be used directly by experienced users.

Usage

ivx_fit(y, x, horizon = 1, offset = NULL, ...)ivx_wfit(y, x, w, horizon = 1, offset = NULL, ...)

Arguments

y

vector of observations of lengthn, or a matrix withn rows.

x

design matrix of dimensionn * p.

horizon

is the horizon (default horizon = 1 corresponds to ashort-horizon regression).

offset

(numeric of lengthn). This can be used tospecify ana priori known component to be included in thelinear predictor during fitting.

...

currently disregarded.

w

vector of weights (lengthn) to be used in the fittingprocess for thewfit functions. Weighted least squares isused with weightsw, i.e.,sum(w * e^2) is minimized.

Examples

ivx_fit(monthly$Ret, as.matrix(monthly$LTY))

KMS Monthly data

Description

The dataset that was used in Kostakis et al (2015), containinga range of financial variables.

Usage

kms

Format

A data.frame with 13 variables and 1,033 observations.

Source

https://drive.google.com/open?id=1FdT2STHO2Lnlweom4AwICVf-rpVMfgV4


KMS Quarterly data

Description

The dataset that was used in Kostakis et al (2015), containinga range of financial variables.

Usage

kms_quarterly

Format

A data.frame with 13 variables and 345 observations.

Source

https://drive.google.com/open?id=1FdT2STHO2Lnlweom4AwICVf-rpVMfgV4


Monthly dataset of KMS

Description

Monthly dataset of KMS

Usage

monthly

Format

An object of classtbl_df (inherits fromtbl,data.frame) with 1033 rows and 13 columns.


Quarterly dataset of KMS

Description

Quarterly dataset of KMS

Usage

quarterly

Format

An object of classtbl_df (inherits fromtbl,data.frame) with 345 rows and 13 columns.


Summarizing IVX Model Fits

Description

summary method for class "ivx".

Usage

## S3 method for class 'ivx'summary(object, ...)## S3 method for class 'summary.ivx'print(  x,  digits = max(3L, getOption("digits") - 3L),  signif.stars = getOption("show.signif.stars"),  ...)

Arguments

object

object of class "ivx", usually, a result of a call to ivx.

...

further arguments passed to or from other methods.

x

an object of class"summary.lm", usually, a result of acall tosummary.lm.

digits

the number of significant digits to use when printing.

signif.stars

logical. IfTRUE, ‘significance stars’are printed for each coefficient.

Examples

mod <- ivx(Ret ~ LTY, data = monthly)summary(mod)

Summarizing IVX-AR Model Fits

Description

summary method for class "ivx".

Usage

## S3 method for class 'ivx_ar'summary(object, ...)## S3 method for class 'summary.ivx_ar'print(  x,  digits = max(3L, getOption("digits") - 3L),  signif.stars = getOption("show.signif.stars"),  ...)

Arguments

object

object of class "ivx_ar", usually, a result of a call to ivx_ar.

...

further arguments passed to or from other methods.

x

an object of class"summary.lm", usually, a result of acall tosummary.lm.

digits

the number of significant digits to use when printing.

signif.stars

logical. IfTRUE, ‘significance stars’are printed for each coefficient.

Examples

mod <- ivx_ar(Ret ~ LTY, data = kms)summary(mod)

Calculate Variance-Covariance Matrix for a Fitted Model Object

Description

Calculate Variance-Covariance Matrix for a Fitted Model Object

Usage

## S3 method for class 'ivx'vcov(object, complete = TRUE, ...)## S3 method for class 'summary.ivx'vcov(object, complete = TRUE, ...)

Arguments

object

a fitted ivx and summary.ivx object.

complete

logical indicating if the full variance-covariance matrixshould be returned. When complete = TRUE, vcov() is compatible with coef().

...

additional arguments for method functions.

Value

A matrix of the estimated covariances between the parameter estimatesof the model. This should have row and column names corresponding to theparameter names given by the coef method.

Examples

mod <- ivx(Ret ~ LTY, data = monthly)vcov(mod)

YLPC Quarterly data

Description

The dataset that was used in ..., containinga range of variables.

Usage

ylpc

Format

An object of classspec_tbl_df (inherits fromtbl_df,tbl,data.frame) with 174 rows and 12 columns.

Source

Yang, B., Long, W., Peng, L., and Cai, Z. (2020).Autoregressive-model-based inference for predictive regressions withpersistent predictors. Journal of the American Statistical Association,115(530), 1029-1039. DOI: 10.1080/01621459.2019.1686392


[8]ページ先頭

©2009-2025 Movatter.jp