Title: | Robust Econometric Inference |
---|---|
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>. |
Authors: | Kostas Vasilopoulos [cre, aut], Efthymios Pavlidis [aut] |
Maintainer: | Kostas Vasilopoulos <[email protected]> |
License: | GPL-3 |
Version: | 1.1.0 |
Built: | 2024-11-17 06:51:53 UTC |
Source: | CRAN |
Autocorrelation tests
ac_test(x, lag_max = 5)
ac_test(x, lag_max = 5)
x |
the residuals or an |
lag_max |
the maximum length of lags. |
obj <- ivx(hpi ~ cpi + def + int + log(res), data = ylpc) lmtest::bgtest(hpi ~ cpi + def + int + log(res), data = ylpc) ac_test(obj, 5)
obj <- ivx(hpi ~ cpi + def + int + log(res), data = ylpc) lmtest::bgtest(hpi ~ cpi + def + int + log(res), data = ylpc) ac_test(obj, 5)
ac_test_wald
: Wald test
ac_test_lb
: Ljung-Box
ac_test_bp
: Box-Pierce
ac_test_bg
: Breusch-Godfrey
ac_test_wald(x, lag) ac_test_lb(x, lag) ac_test_bp(x, lag) ac_test_bg(x, order, type, fill)
ac_test_wald(x, lag) ac_test_lb(x, lag) ac_test_bp(x, lag) ac_test_bg(x, order, type, fill)
x |
an |
lag |
the number of lags. |
order |
lag TODO |
type |
the type of test statistic to be returned. Either "Chisq" for the 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. |
#' If p-value < 0.051: You can reject the null hypothesis assuming a 5% chance of making a mistake. So you can assume that your values are showing dependence on each other.
a numeric scalar or numeric vector.
Box.test
lmtest::bgtest
mdl <- ivx(hpi ~ cpi + inv, data = ylpc) ac_test_wald(mdl)
mdl <- ivx(hpi ~ cpi + inv, data = ylpc) ac_test_wald(mdl)
Computes the long-run correlation coefficient between the residuals of the predictive regression and the autoregressive model for the regressor.
delta(object)
delta(object)
object |
on object of class "ivx" |
A vector of the estimated correlation coefficients. This should have row and column names corresponding to the parameter names given by the coef method.
mod <- ivx(Ret ~ LTY, data = monthly) delta(mod)
mod <- ivx(Ret ~ LTY, data = monthly) delta(mod)
extract
method for ivx
objectsextract
method for ivx
objects
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, ... )
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, ... )
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 GOF block? |
include.bic |
Report the Bayesian Information Criterion (BIC) in the GOF block? |
include.rsquared |
Report the R-squared. |
include.adjrs |
Report the Adjusted R-squared. |
... |
Custom parameters, which are handed over to subroutines. Currently not in use. |
ivx fits predictive regression models. The method allows standard chi-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.
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), ...)
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), ...)
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 by
|
horizon |
is the horizon (default horizon = 1 corresponds to a short-horizon regression). |
na.action |
a function which indicates what should happen when the data
contain NAs. The default is set by the na.action setting of |
weights |
an optional vector of weights to be used in the fitting process.
Should be |
contrasts |
an optional list. See the |
offset |
this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be NULL or a numeric vector or matrix of extents matching those of the response. One or more offset terms can be included in the formula instead or as well, and if more than one are specified their sum is used. See model.offset |
model |
logical. If |
x |
an object of class "ivx", usually, a result of a call to ivx. |
y |
logical. If |
... |
additional arguments to be passed to the low level regression fitting functions (see lm). |
digits |
the number of significant digits to use when printing. |
an object of class "ivx".
Magdalinos, T., & Phillips, P. (2009). Limit Theory for Cointegrated Systems 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 of Financial Studies, 28(5), 1506-1553.
# Univariate ivx(Ret ~ LTY, data = kms) # Multivariate ivx(Ret ~ LTY + TBL, data = kms) # Longer horizon ivx(Ret ~ LTY + TBL, data = kms, horizon = 4) wt <- runif(nrow(kms)) ivx(Ret ~ LTY, data = kms, weights = wt)
# Univariate ivx(Ret ~ LTY, data = kms) # Multivariate ivx(Ret ~ LTY + TBL, data = kms) # Longer horizon ivx(Ret ~ LTY + TBL, data = kms, horizon = 4) wt <- runif(nrow(kms)) ivx(Ret ~ LTY, data = kms, weights = wt)
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 error terms of the linear predictive regression model.
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), ...)
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), ...)
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 by
|
horizon |
is the horizon (default horizon = 1 corresponds to a short-horizon regression). |
ar |
Method to include the autoregressive terms. "auto" find the optimal
ar order by using the information criteria. |
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 data
contain NAs. The default is set by the na.action setting of |
contrasts |
an optional list. See the |
offset |
this can be used to specify an a priori known component to be included in the linear predictor during fitting. This should be NULL or a numeric vector or matrix of extents matching those of the response. One or more offset terms can be included in the formula instead or as well, and if more than one are specified their sum is used. See model.offset |
model |
logical. If |
x |
an object of class "ivx_ar", usually, a result of a call to ivx_ar. |
y |
logical. If |
... |
additional arguments to be passed to the low level regression fitting functions (see lm). |
digits |
the number of significant digits to use when printing. |
Yang, B., Long, W., Peng, L., & Cai, Z. (2020). Testing the Predictability of US Housing Price Index Returns Based on an IVX-AR Model. Journal of the American Statistical Association, 1-22. DOI: doi:10.1080/01621459.2019.1686392
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)
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)
Basic function called by ivx_ar
to fit predictive models.
These should only be used directly by experienced users.
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), ... )
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), ... )
y |
vector of observations of length |
x |
design matrix of dimension |
horizon |
is the horizon (default horizon = 1 corresponds to a short-horizon regression). |
offset |
(numeric of length |
ar |
Method to include the autoregressive terms. "auto" find the optimal
ar order by using the information criteria. |
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.
If |
ivx_ar_fit(monthly$Ret, as.matrix(monthly$LTY)) ivx_ar_fit(monthly$Ret, as.matrix(monthly$LTY), ar = 1)
ivx_ar_fit(monthly$Ret, as.matrix(monthly$LTY)) ivx_ar_fit(monthly$Ret, as.matrix(monthly$LTY), ar = 1)
Basic function called by ivx
to fit predictive models.
These should only be used directly by experienced users.
ivx_fit(y, x, horizon = 1, offset = NULL, ...) ivx_wfit(y, x, w, horizon = 1, offset = NULL, ...)
ivx_fit(y, x, horizon = 1, offset = NULL, ...) ivx_wfit(y, x, w, horizon = 1, offset = NULL, ...)
y |
vector of observations of length |
x |
design matrix of dimension |
horizon |
is the horizon (default horizon = 1 corresponds to a short-horizon regression). |
offset |
(numeric of length |
... |
currently disregarded. |
w |
vector of weights (length |
ivx_fit(monthly$Ret, as.matrix(monthly$LTY))
ivx_fit(monthly$Ret, as.matrix(monthly$LTY))
The dataset that was used in Kostakis et al (2015), containing a range of financial variables.
Date: year-month-date (monthly frequency)
DE: dividend payout ratio
LTY: long-term yield
DY: dividend yield
DP: dividend-price ratio
TBL: T-bill rate
EP: earnings-price ratio
BM: book-to-market value ratio
INF: inflation rate
DFY: default yield spread
NTIS: net equity expansion
TMS: term spread
Ret: S&P 500 value-weighted log excess returns
kms
kms
A data.frame with 13 variables and 1,033 observations.
https://drive.google.com/open?id=1FdT2STHO2Lnlweom4AwICVf-rpVMfgV4
The dataset that was used in Kostakis et al (2015), containing a range of financial variables.
Date: year-month-date
DE: dividend payout ratio
LTY: long-term yield
DY: dividend yield
DP: dividend-price ratio
TBL: T-bill rate
EP: earnings-price ratio
BM: book-to-market value ratio
INF: inflation rate
DFY: default yield spread
NTIS: net equity expansion
TMS: term spread
Ret: S&P 500 value-weighted log excess returns
kms_quarterly
kms_quarterly
A data.frame with 13 variables and 345 observations.
https://drive.google.com/open?id=1FdT2STHO2Lnlweom4AwICVf-rpVMfgV4
summary method for class "ivx".
## 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"), ... )
## 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"), ... )
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 |
digits |
the number of significant digits to use when printing. |
signif.stars |
logical. If |
mod <- ivx(Ret ~ LTY, data = monthly) summary(mod)
mod <- ivx(Ret ~ LTY, data = monthly) summary(mod)
summary method for class "ivx".
## 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"), ... )
## 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"), ... )
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 |
digits |
the number of significant digits to use when printing. |
signif.stars |
logical. If |
mod <- ivx_ar(Ret ~ LTY, data = kms) summary(mod)
mod <- ivx_ar(Ret ~ LTY, data = kms) summary(mod)
Calculate Variance-Covariance Matrix for a Fitted Model Object
## S3 method for class 'ivx' vcov(object, complete = TRUE, ...) ## S3 method for class 'summary.ivx' vcov(object, complete = TRUE, ...)
## S3 method for class 'ivx' vcov(object, complete = TRUE, ...) ## S3 method for class 'summary.ivx' vcov(object, complete = TRUE, ...)
object |
a fitted ivx and summary.ivx object. |
complete |
logical indicating if the full variance-covariance matrix should be returned. When complete = TRUE, vcov() is compatible with coef(). |
... |
additional arguments for method functions. |
A matrix of the estimated covariances between the parameter estimates of the model. This should have row and column names corresponding to the parameter names given by the coef method.
mod <- ivx(Ret ~ LTY, data = monthly) vcov(mod)
mod <- ivx(Ret ~ LTY, data = monthly) vcov(mod)
The dataset that was used in ..., containing a range of variables.
ylpc
ylpc
An object of class spec_tbl_df
(inherits from tbl_df
, tbl
, data.frame
) with 174 rows and 12 columns.