Title: | An R Package for Factor Model Asset Pricing |
---|---|
Description: | Functions for evaluating and testing asset pricing models, including estimation and testing of factor risk premia, selection of "strong" risk factors (factors having nonzero population correlation with test asset returns), heteroskedasticity and autocorrelation robust covariance matrix estimation and testing for model misspecification and identification. The functions for estimating and testing factor risk premia implement the Fama-MachBeth (1973) <doi:10.1086/260061> two-pass approach, the misspecification-robust approaches of Kan-Robotti-Shanken (2013) <doi:10.1111/jofi.12035>, and the approaches based on tradable factor risk premia of Quaini-Trojani-Yuan (2023) <doi:10.2139/ssrn.4574683>. The functions for selecting the "strong" risk factors are based on the Oracle estimator of Quaini-Trojani-Yuan (2023) <doi:10.2139/ssrn.4574683> and the factor screening procedure of Gospodinov-Kan-Robotti (2014) <doi:10.2139/ssrn.2579821>. The functions for evaluating model misspecification implement the HJ model misspecification distance of Kan-Robotti (2008) <doi:10.1016/j.jempfin.2008.03.003>, which is a modification of the prominent Hansen-Jagannathan (1997) <doi:10.1111/j.1540-6261.1997.tb04813.x> distance. The functions for testing model identification specialize the Kleibergen-Paap (2006) <doi:10.1016/j.jeconom.2005.02.011> and the Chen-Fang (2019) <doi:10.1111/j.1540-6261.1997.tb04813.x> rank test to the regression coefficient matrix of test asset returns on risk factors. Finally, the function for heteroskedasticity and autocorrelation robust covariance estimation implements the Newey-West (1994) <doi:10.2307/2297912> covariance estimator. |
Authors: | Alberto Quaini [aut, cre, cph] |
Maintainer: | Alberto Quaini <[email protected]> |
License: | GPL (>= 3) |
Version: | 2.1.0 |
Built: | 2024-10-27 05:19:52 UTC |
Source: | https://github.com/a91quaini/intrinsicfrp |
Tests the null hypothesis of reduced rank in the matrix of regression
loadings for test asset excess returns on risk factors using the Chen-Fang (2019)
doi:10.3982/QE1139
beta rank test. The test applies the Kleibergen-Paap (2006) doi:10.1016/j.jeconom.2005.02.011
iterative rank test
for initial rank estimation when target_level_kp2006_rank_test > 0
, with an
adjustment to level = target_level_kp2006_rank_test / n_factors
. When
target_level_kp2006_rank_test <= 0
, the number of singular values above
n_observations^(-1/4)
is used instead. It presumes that the number of factors
is less than the number of returns (n_factors < n_returns
).
All the details can be found in Chen-Fang (2019)
doi:10.3982/QE1139.
ChenFang2019BetaRankTest( returns, factors, n_bootstrap = 500, target_level_kp2006_rank_test = 0.05, check_arguments = TRUE )
ChenFang2019BetaRankTest( returns, factors, n_bootstrap = 500, target_level_kp2006_rank_test = 0.05, check_arguments = TRUE )
returns |
Matrix of test asset excess returns with dimensions |
factors |
Matrix of risk factors with dimensions |
n_bootstrap |
The number of bootstrap samples to use in the Chen-Fang (2019) test. Defaults to 500 if not specified. |
target_level_kp2006_rank_test |
The significance level for the Kleibergen-Paap (2006)
rank test used for initial rank estimation. If set above 0, it indicates the level for this
estimation within the Chen-Fang (2019) rank test. If set at 0 or negative, the initial rank
estimator defaults to the count of singular values exceeding |
check_arguments |
Logical flag to determine if input arguments should be checked for validity.
Default is |
A list containing the Chen-Fang (2019) rank statistic and the associated p-value.
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # compute the model identification test hj_test = ChenFang2019BetaRankTest(returns, factors)
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # compute the model identification test hj_test = ChenFang2019BetaRankTest(returns, factors)
07/1963
to 02/2024
Monthly observations from 07/1963
to 02/2024
of
the Fama-French 5
factors and the momentum factor.
factors
factors
factors
A data frame with 624
rows and 7
columns:
Date in yyyymm format
Factor observations
https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html
Computes the three-pass procedure of Feng Giglio and Xiu (2020)
doi:org/10.1111/jofi.12883, which evaluates the contribution
to cross-sectional pricing of any new factors on top of a set of control
factors.
The third step is a OLS regression of average returns on the covariances between
asset returns and the new factors, as well as the control factors selected
in either one of the first two steps.
The first stwo steps consists in (i) a Lasso regression of average returns
on the ovariances between asset returns and all control factors and (ii)
a Lasso regression of the covariances between asset returns and the new factors
on the ovariances between asset returns and all control factors.
The second selection aims at correcting for potential omitted variables in the
first selection.
Tuning of the penalty parameters in the Lasso regressions is performed via
Cross Validation (CV).
Standard errors are computed following Feng Giglio and Xiu (2020) using the
Newey-West (1994) doi:10.2307/2297912 plug-in procedure to select the number
of relevant lags, i.e., n_lags = 4 * (n_observations/100)^(2/9)
.
For the standard error computations, the function allows to internally
pre-whiten the series by fitting a VAR(1),
i.e., a vector autoregressive model of order 1.
FGXFactorsTest( gross_returns, control_factors, new_factors, n_folds = 5, check_arguments = TRUE )
FGXFactorsTest( gross_returns, control_factors, new_factors, n_folds = 5, check_arguments = TRUE )
gross_returns |
A |
control_factors |
A |
new_factors |
A |
n_folds |
An integer indicating
the number of k-fold for cross validation. Default is |
check_arguments |
A boolean |
A list containing the n_new_factors
-dimensional vector of SDF
coefficients in "sdf_coefficients"
and corresponding standard errors in
"standard_errors"
; it also returns the index of control factors that are
selected by the two-step selection procedure.
# import package data on 6 risk factors and 42 test asset excess returns control_factors = intrinsicFRP::factors[,2:4] new_factors = intrinsicFRP::factors[,5:7] returns = intrinsicFRP::returns[,-1] RF = intrinsicFRP::risk_free[,-1] gross_returns = returns + 1 + RF output = FGXFactorsTest( gross_returns, control_factors, new_factors )
# import package data on 6 risk factors and 42 test asset excess returns control_factors = intrinsicFRP::factors[,2:4] new_factors = intrinsicFRP::factors[,5:7] returns = intrinsicFRP::returns[,-1] RF = intrinsicFRP::risk_free[,-1] gross_returns = returns + 1 + RF output = FGXFactorsTest( gross_returns, control_factors, new_factors )
Computes the Fama-MachBeth (1973) doi:10.1086/260061 factor
risk premia:
FMFRP = (beta' * beta)^{-1} * beta' * E[R]
where
beta = Cov[R, F] * V[F]^{-1}
or the misspecification-robust factor risk premia of Kan-Robotti-Shanken (2013)
doi:10.1111/jofi.12035:
KRSFRP = (beta' * V[R]^{-1} * beta)^{-1} * beta' * V[R]^{-1} * E[R]
,
from data on factors F
and test
asset excess returns R
.
These notions of factor risk premia are by construction the negative
covariance of factors F
with candidate SDF
M = 1 - d' * (F - E[F])
,
where SDF coefficients d
are obtained by minimizing pricing errors:
argmin_{d} (E[R] - Cov[R,F] * d)' * (E[R] - Cov[R,F] * d)
and
argmin_{d} (E[R] - Cov[R,F] * d)' * V[R]^{-1} * (E[R] - Cov[R,F] * d)
,
respectively.
Optionally computes the corresponding
heteroskedasticity and autocorrelation robust standard errors (accounting
for a potential model misspecification) using the
Newey-West (1994) doi:10.2307/2297912 plug-in procedure to select the
number of relevant lags, i.e., n_lags = 4 * (n_observations/100)^(2/9)
.
For the standard error computations, the function allows to internally
pre-whiten the series by fitting a VAR(1),
i.e., a vector autoregressive model of order 1.
All the details can be found in Kan-Robotti-Shanken (2013)
doi:10.1111/jofi.12035.
FRP( returns, factors, misspecification_robust = TRUE, include_standard_errors = FALSE, hac_prewhite = FALSE, target_level_gkr2014_screening = 0, check_arguments = TRUE )
FRP( returns, factors, misspecification_robust = TRUE, include_standard_errors = FALSE, hac_prewhite = FALSE, target_level_gkr2014_screening = 0, check_arguments = TRUE )
returns |
A |
factors |
A |
misspecification_robust |
A boolean: |
include_standard_errors |
A boolean: |
hac_prewhite |
A boolean indicating if the series needs pre-whitening by
fitting an AR(1) in the internal heteroskedasticity and autocorrelation
robust covariance (HAC) estimation. Default is |
target_level_gkr2014_screening |
A number indicating the target level of
the tests underlying the factor screening procedure in Gospodinov-Kan-Robotti
(2014). If it is zero, then no factor screening procedure is
implemented. Otherwise, it implements an iterative screening procedure
based on the sequential removal of factors associated with the smallest insignificant
t-test of a nonzero SDF coefficient. The threshold for the absolute t-test is
|
check_arguments |
A boolean: |
A list containing n_factors
-dimensional vector of factor
risk premia in "risk_premia"
; if include_standard_errors = TRUE
, then
it further includes n_factors
-dimensional vector of factor risk
premia standard errors in "standard_errors"
;
if target_level_gkr2014_screening >= 0
, it further includes the indices of
the selected factors in selected_factor_indices
.
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # compute KRS factor risk premia and their standard errors frp = FRP(returns, factors, include_standard_errors = TRUE)
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # compute KRS factor risk premia and their standard errors frp = FRP(returns, factors, include_standard_errors = TRUE)
Computes the factor risk premia using the 3-step procedure of Giglio and Xiu (2021) doi:10.1086/714090. The procedure consists in
extracting p PCA from returns, where p is a consistent estimator of the number of strong latent factors, 2) compute a cross-sectional regression of average returns on the estimated betas of the p latent factors, and 3) compute a time-series regression of observed factors on the p latent factors to obtain their mimicking portfolio risk premia.
GiglioXiu2021RiskPremia( returns, factors, which_n_pca = 0, check_arguments = TRUE )
GiglioXiu2021RiskPremia( returns, factors, which_n_pca = 0, check_arguments = TRUE )
returns |
A |
factors |
A |
which_n_pca |
Method to determine the number of PCA components:
|
check_arguments |
A boolean: |
A list containing:
A matrix of factor risk premia.
The number of principal components used.
## Not run: returns <- matrix(rnorm(200), nrow=20, ncol=10) factors <- matrix(rnorm(60), nrow=20, ncol=3) which_n_pca <- 0 result <- GiglioXiu2021RiskPremia(returns, factors, which_n_pca) print(result) ## End(Not run)
## Not run: returns <- matrix(rnorm(200), nrow=20, ncol=10) factors <- matrix(rnorm(60), nrow=20, ncol=3) which_n_pca <- 0 result <- GiglioXiu2021RiskPremia(returns, factors, which_n_pca) print(result) ## End(Not run)
Performs the factor screening procedure of
Gospodinov-Kan-Robotti (2014) doi:10.2139/ssrn.2579821, which is
an iterative model screening procedure
based on the sequential removal of factors associated with the smallest insignificant
t-test of a nonzero misspecification-robust SDF coefficient. The significance threshold for the
absolute t-test is set to target_level / n_factors
,
where n_factors indicates the number of factors in the model at the current iteration;
that is, it takes care of the multiple testing problem via a conservative
Bonferroni correction. Standard errors are computed with the
heteroskedasticity and autocorrelation using the Newey-West (1994)
doi:10.2307/2297912 estimator, where the number of lags
is selected using the Newey-West plug-in procedure:
n_lags = 4 * (n_observations/100)^(2/9)
.
For the standard error computations, the function allows to internally
pre-whiten the series by fitting a VAR(1),
i.e., a vector autoregressive model of order 1.
All the details can be found in Gospodinov-Kan-Robotti (2014) doi:10.2139/ssrn.2579821.
GKRFactorScreening( returns, factors, target_level = 0.05, hac_prewhite = FALSE, check_arguments = TRUE )
GKRFactorScreening( returns, factors, target_level = 0.05, hac_prewhite = FALSE, check_arguments = TRUE )
returns |
|
factors |
|
target_level |
Number specifying the target significance threshold for the
tests underlying the GKR factor screening procedure.
To account for the multiple testing problem, the significance threshold for the
absolute t-test is given by |
hac_prewhite |
A boolean indicating if the series needs prewhitening by
fitting an AR(1) in the internal heteroskedasticity and autocorrelation
robust covariance (HAC) estimation. Default is |
check_arguments |
boolean |
A list contaning the selected GKR SDF coefficients in SDF_coefficients
,
their standard errors in standard_errors
,
t-statistics in t_statistics
and indices in the columns of the factor matrix factors
supplied by the user in selected_factor_indices
.
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # Perform the GKR factor screening procedure screen = GKRFactorScreening(returns, factors)
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # Perform the GKR factor screening procedure screen = GKRFactorScreening(returns, factors)
This function estimates the long-run covariance matrix of a multivariate
centred time series accounting for heteroskedasticity and autocorrelation
using the Newey-West (1994)
doi:10.2307/2297912 estimator.
The number is selected using the Newey-West plug-in procedure, where
n_lags = 4 * (n_observations/100)^(2/9)
.
The function allows to internally prewhiten the series by fitting a VAR(1).
All the details can be found in Newey-West (1994)
doi:10.2307/2297912.
HACcovariance(series, prewhite = FALSE, check_arguments = TRUE)
HACcovariance(series, prewhite = FALSE, check_arguments = TRUE)
series |
A matrix (or vector) of data where each column is a time series. |
prewhite |
A boolean indicating if the series needs prewhitening by
fitting an AR(1). Default is |
check_arguments |
A boolean |
A symmetric matrix (or a scalar if only one column series is provided) representing the estimated HAC covariance.
# Import package data on 6 risk factors and 42 test asset excess returns returns = intrinsicFRP::returns[,-1] factors = intrinsicFRP::factors[,-1] # Fit a linear model of returns on factors fit = stats::lm(returns ~ factors) # Extract residuals from the model residuals = stats::residuals(fit) # Compute the HAC covariance of the residuals hac_covariance = HACcovariance(residuals) # Compute the HAC covariance of the residuals imposing prewhitening hac_covariance_pw = HACcovariance(residuals, prewhite = TRUE)
# Import package data on 6 risk factors and 42 test asset excess returns returns = intrinsicFRP::returns[,-1] factors = intrinsicFRP::factors[,-1] # Fit a linear model of returns on factors fit = stats::lm(returns ~ factors) # Extract residuals from the model residuals = stats::residuals(fit) # Compute the HAC covariance of the residuals hac_covariance = HACcovariance(residuals) # Compute the HAC covariance of the residuals imposing prewhitening hac_covariance_pw = HACcovariance(residuals, prewhite = TRUE)
Computes the Kan-Robotti (2008) <10.1016/j.jempfin.2008.03.003>
squared model misspecification distance:
square_distance = min_{d} (E[R] - Cov[R,F] * d)' * V[R]^{-1} * (E[R] - Cov[R,F] * d)
,
where R
denotes test asset excess returns and F
risk factors,
and computes the associated confidence interval.
This model misspecification distance is a modification of the prominent
Hansen-Jagannathan (1997) doi:10.1111/j.1540-6261.1997.tb04813.x
distance, adapted to the use of excess returns for the test asset, and a
SDF that is a linear function of demeaned factors.
Clearly, computation of the confidence interval is obtained by means of an
asymptotic analysis under potentially misspecified models, i.e.,
without assuming correct model specification.
Details can be found in Kan-Robotti (2008) <10.1016/j.jempfin.2008.03.003>.
HJMisspecificationDistance( returns, factors, ci_coverage = 0.95, hac_prewhite = FALSE, check_arguments = TRUE )
HJMisspecificationDistance( returns, factors, ci_coverage = 0.95, hac_prewhite = FALSE, check_arguments = TRUE )
returns |
A |
factors |
A |
ci_coverage |
A number indicating the confidence interval coverage
probability. Default is |
hac_prewhite |
A boolean indicating if the series needs pre-whitening by
fitting an AR(1) in the internal heteroskedasticity and autocorrelation
robust covariance (HAC) estimation. Default is |
check_arguments |
A boolean: |
@return A list containing the squared misspecification-robust HJ
distance in squared_distance
, and the lower and upper confidence bounds
in lower_bound
and upper_bound
, respectively.
# Import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # Compute the HJ model misspecification distance hj_test = HJMisspecificationDistance(returns, factors)
# Import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # Compute the HJ model misspecification distance hj_test = HJMisspecificationDistance(returns, factors)
Evaluates the rank of regression loadings in an asset pricing model using the
iterative Kleibergen-Paap (2006) doi:10.1016/j.jeconom.2005.02.011 beta rank test.
It systematically tests the null hypothesis
for each potential rank q = 0, ..., n_factors - 1
and estimates the rank as the smallest q
that has a p-value below the significance level, adjusted for the number of factors.
The function presupposes more returns than factors (n_factors < n_returns
).
All the details can be found in Kleibergen-Paap (2006) doi:10.1016/j.jeconom.2005.02.011.
IterativeKleibergenPaap2006BetaRankTest( returns, factors, target_level = 0.05, check_arguments = TRUE )
IterativeKleibergenPaap2006BetaRankTest( returns, factors, target_level = 0.05, check_arguments = TRUE )
returns |
A matrix of test asset excess returns with dimensions |
factors |
A matrix of risk factors with dimensions |
target_level |
A numeric value specifying the significance level for the test. For each
hypothesis test |
check_arguments |
Logical flag indicating whether to perform internal checks of the
function's arguments. Defaults to |
A list containing estimates of the regression loading rank and the associated
iterative Kleibergen-Paap 2006 beta rank statistics and p-values for each q
.
# import package data on 15 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # compute the model identification test hj_test = ChenFang2019BetaRankTest(returns, factors)
# import package data on 15 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # compute the model identification test hj_test = ChenFang2019BetaRankTest(returns, factors)
Computes Oracle tradable factor risk premia of
Quaini-Trojani-Yuan (2023) doi:10.2139/ssrn.4574683 from data on
K
factors F = [F_1,...,F_K]'
and test asset excess returns R
:
OTFRP = argmin_x ||TFRP - x||_2^2 + tau * sum_{k=1}^K w_k * |x_k|
,
where TFRP
is the tradable factor risk premia estimator, tau > 0
is a
penalty parameter, and the Oracle weights are given by
w_k = 1 / ||corr[F_k, R]||_2^2
.
This estimator is called "Oracle" in the sense that the probability that
the index set of its nonzero estimated risk premia equals the index set of
the true strong factors tends to 1 (Oracle selection), and that on the strong
factors, the estimator reaches the optimal asymptotic Normal distribution.
Here, strong factors are those that have a nonzero population marginal
correlation with asset excess returns.
Tuning of the penalty parameter tau
is performed via Generalized Cross
Validation (GCV), Cross Validation (CV) or Rolling Validation (RV).
GCV tunes parameter tau
by minimizing the criterium:
||PE(tau)||_2^2 / (1-df(tau)/T)^2
where
PE(tau) = E[R] - beta_{S(tau)} * OTFRP(tau)
are the pricing errors of the model for given tuning parameter tau
,
with S(tau)
being the index set of the nonzero Oracle TFRP computed with
tuning parameter tau
, and
beta_{S(tau)} = Cov[R, F_{S(tau)}] * (Cov[F_{S(tau)}, R] * V[R]^{-1} * Cov[R, F_{S(tau)}])^{-1}
the regression coefficients of the test assets excess returns on the
factor mimicking portfolios,
and df(tau) = |S(tau)|
are the degrees of freedom of the model, given by the
number of nonzero Oracle TFRP.
CV and RV, instead, choose the value of tau
that minimize the criterium:
PE(tau)' * V[PE(tau)]^{-1} PE(tau)
where V[PE(tau)]
is the diagonal matrix collecting the marginal variances
of pricing errors PE(tau)
, and each of these components are
aggregated over k-fold cross-validated data or over rolling windows of data,
respectively.
Oracle weights can be based on the correlation between factors and returns
(suggested approach),
on the regression coefficients of returns on factors or on the first-step
tradable risk premia estimator. Optionally computes the corresponding
heteroskedasticity and autocorrelation robust standard errors using the
Newey-West (1994) doi:10.2307/2297912 plug-in procedure to select the number
of relevant lags, i.e., n_lags = 4 * (n_observations/100)^(2/9)
.
For the standard error computations, the function allows to internally
pre-whiten the series by fitting a VAR(1),
i.e., a vector autoregressive model of order 1.
All details are found in Quaini-Trojani-Yuan (2023) doi:10.2139/ssrn.4574683.
OracleTFRP( returns, factors, penalty_parameters, weighting_type = "c", tuning_type = "g", one_stddev_rule = TRUE, gcv_scaling_n_assets = FALSE, gcv_identification_check = FALSE, target_level_kp2006_rank_test = 0.05, n_folds = 5, n_train_observations = 120, n_test_observations = 12, roll_shift = 12, relaxed = FALSE, include_standard_errors = FALSE, hac_prewhite = FALSE, plot_score = TRUE, check_arguments = TRUE )
OracleTFRP( returns, factors, penalty_parameters, weighting_type = "c", tuning_type = "g", one_stddev_rule = TRUE, gcv_scaling_n_assets = FALSE, gcv_identification_check = FALSE, target_level_kp2006_rank_test = 0.05, n_folds = 5, n_train_observations = 120, n_test_observations = 12, roll_shift = 12, relaxed = FALSE, include_standard_errors = FALSE, hac_prewhite = FALSE, plot_score = TRUE, check_arguments = TRUE )
returns |
A |
factors |
A |
penalty_parameters |
A |
weighting_type |
A character specifying the type of adaptive weights:
based on the correlation between factors and returns |
tuning_type |
A character indicating the parameter tuning type:
|
one_stddev_rule |
A boolean: |
gcv_scaling_n_assets |
(only relevant for |
gcv_identification_check |
(only relevant for |
target_level_kp2006_rank_test |
(only relevant for |
n_folds |
(only relevant for |
n_train_observations |
(only relevant for |
n_test_observations |
(only relevant for |
roll_shift |
(only relevant for |
relaxed |
A boolean: |
include_standard_errors |
A boolean |
hac_prewhite |
A boolean indicating if the series needs prewhitening by
fitting an AR(1) in the internal heteroskedasticity and autocorrelation
robust covariance (HAC) estimation. Default is |
plot_score |
A boolean: |
check_arguments |
A boolean |
A list containing the n_factors
-dimensional vector of adaptive
tradable factor risk premia in "risk_premia"
; the optimal penalty
parameter value in "penalty_parameter"
; the model score for each penalty
parameter value in "model_score"
; if include_standard_errors = TRUE
, then
it further includes n_factors
-dimensional vector of tradable factor risk
premia standard errors in "standard_errors"
.
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] penalty_parameters = seq(0., 1., length.out = 100) # compute optimal adaptive tradable factor risk premia and their standard errors oracle_tfrp = OracleTFRP( returns, factors, penalty_parameters, include_standard_errors = TRUE )
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] penalty_parameters = seq(0., 1., length.out = 100) # compute optimal adaptive tradable factor risk premia and their standard errors oracle_tfrp = OracleTFRP( returns, factors, penalty_parameters, include_standard_errors = TRUE )
07/1963
to 02/2024
Monthly excess returns on the 25
Size/Book-to-Market double sorted portfolios
and the 17
industry portfolios from 07/1963
to 02/2024
.
returns
returns
returns
A data frame with 624
rows and 43
columns:
Date in yyyymm format
Asset excess returns
https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html
07/1963
to 02/2024
Monthly observations from 07/1963
to 02/2024
of
the US risk free asset.
risk_free
risk_free
risk_free
A data frame with 624
rows and 2
columns:
Date in yyyymm format
risk free observations
https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html
Computes the SDF coefficients of Fama-MachBeth (1973) doi:10.1086/260061
FMSDFcoefficients = (C' * C)^{-1} * C' * E[R]
or the misspecification-robust SDF coefficients of
Gospodinov-Kan-Robotti (2014) doi:10.1093/rfs/hht135:
GKRSDFcoefficients = (C' * V[R]^{-1} * C)^{-1} * C' * V[R]^{-1} * E[R]
from data on factors F
and test asset excess returns R
.
These notions of SDF coefficients minimize pricing errors:
argmin_{d} (E[R] - Cov[R,F] * d)' * W * (E[R] - Cov[R,F] * d)
,
with W=I
, i.e., the identity, and W=V[R]^{-1}
, respectively.
Optionally computes the corresponding
heteroskedasticity and autocorrelation robust standard errors (accounting
for a potential model misspecification) using the
Newey-West (1994) doi:10.2307/2297912 plug-in procedure to select the
number of relevant lags, i.e., n_lags = 4 * (n_observations/100)^(2/9)
.
SDFCoefficients( returns, factors, misspecification_robust = TRUE, include_standard_errors = FALSE, hac_prewhite = FALSE, target_level_gkr2014_screening = 0, check_arguments = TRUE )
SDFCoefficients( returns, factors, misspecification_robust = TRUE, include_standard_errors = FALSE, hac_prewhite = FALSE, target_level_gkr2014_screening = 0, check_arguments = TRUE )
returns |
A |
factors |
A |
misspecification_robust |
A boolean: |
include_standard_errors |
A boolean: |
hac_prewhite |
A boolean indicating if the series needs pre-whitening by
fitting an AR(1) in the internal heteroskedasticity and autocorrelation
robust covariance (HAC) estimation. Default is |
target_level_gkr2014_screening |
A number indicating the target level of
the tests underlying the factor screening procedure in Gospodinov-Kan-Robotti
(2014). If it is zero, then no factor screening procedure is
implemented. Otherwise, it implements an iterative screening procedure
based on the sequential removal of factors associated with the smallest insignificant
t-test of a nonzero SDF coefficient. The threshold for the absolute t-test is
|
check_arguments |
A boolean: |
A list containing n_factors
-dimensional vector of SDF coefficients
in "sdf_coefficients"
; if include_standard_errors = TRUE
, then
it further includes n_factors
-dimensional vector of SDF coefficients'
standard errors in "standard_errors"
;
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # compute GKR SDF coefficients and their standard errors frp = SDFCoefficients(returns, factors, include_standard_errors = TRUE)
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # compute GKR SDF coefficients and their standard errors frp = SDFCoefficients(returns, factors, include_standard_errors = TRUE)
Computes tradable factor risk premia from data on factors F
and
test asset excess returns R
:
TFRP = Cov[F, R] * Var[R]^{-1} * E[R]
;
which are by construction the negative covariance of factors F
with
the SDF projection on asset returns, i.e., the minimum variance SDF.
Optionally computes the corresponding heteroskedasticity and autocorrelation
robust standard errors using the Newey-West (1994) doi:10.2307/2297912
plug-in procedure to select the number of relevant lags, i.e.,
n_lags = 4 * (n_observations/100)^(2/9)
.
For the standard error computations, the function allows to internally
pre-whiten the series by fitting a VAR(1),
i.e., a vector autoregressive model of order 1.
All details are found in Quaini-Trojani-Yuan (2023) doi:10.2139/ssrn.4574683.
TFRP( returns, factors, include_standard_errors = FALSE, hac_prewhite = FALSE, check_arguments = TRUE )
TFRP( returns, factors, include_standard_errors = FALSE, hac_prewhite = FALSE, check_arguments = TRUE )
returns |
A |
factors |
A |
include_standard_errors |
A boolean: |
hac_prewhite |
A boolean indicating if the series needs prewhitening by
fitting an AR(1) in the internal heteroskedasticity and autocorrelation
robust covariance (HAC) estimation. Default is |
check_arguments |
A boolean: |
A list containing n_factors
-dimensional vector of tradable factor
risk premia in "risk_premia"
; if include_standard_errors=TRUE
, then
it further includes n_factors
-dimensional vector of tradable factor risk
premia standard errors in "standard_errors"
.
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # compute tradable factor risk premia and their standard errors tfrp = TFRP(returns, factors, include_standard_errors = TRUE)
# import package data on 6 risk factors and 42 test asset excess returns factors = intrinsicFRP::factors[,-1] returns = intrinsicFRP::returns[,-1] # compute tradable factor risk premia and their standard errors tfrp = TFRP(returns, factors, include_standard_errors = TRUE)