psi_to_priorSR {BayesianFactorZoo} | R Documentation |
Mapping
(psi0
) to the prior Sharpe ratio of factors (priorSR
), and vice versa.
Description
This function provides the one-to-one mapping between and the prior Sharpe ratio of factors.
See Section II.A.3 in Bryzgalova et al. (2023).
Usage
psi_to_priorSR(R, f, psi0 = NULL, priorSR = NULL, aw = 1, bw = 1)
Arguments
R |
A matrix of test assets with dimension |
f |
A matrix of factors with dimension |
psi0 |
The hyper-parameter in the prior distribution of risk prices (see Details in the function |
priorSR |
The prior Sharpe ratio of all factors (see Details); |
aw |
The hyper-parameter in the prior of |
bw |
The hyper-parameter in the prior of |
Details
According to equation (27) in Bryzgalova et al. (2023), we learn that
where and
denote the Sharpe ratios of all factors (
) and of the pricing errors
(
), and
denotes prior expectations.
The prior encodes the belief about the sparsity of the true model using the prior distribution
We further integrate out
in
and show the following:
Since we can decompose the Sharpe ratios of all test assets, , into
and
(i.e.,
), we can
represent
as follows:
We define the prior Sharpe ratio implied by the factor models as .
Given
,
,
, and the observed
Sharpe ratio of test assets, we have one-to-one mapping between
and
.
If the user aims to convert to the prior Sharpe ratio, she should input only
psi0
.
In contrast, if she wants to convert the prior Sharpe ratio to ,
priorSR
should be entered.
Value
The return of psi_to_priorSR
is:
-
psi0
orpriorSR
.
References
Bryzgalova S, Huang J, Julliard C (2023). “Bayesian solutions for the factor zoo: We just ran two quadrillion models <https://doi.org/10.1111/jofi.13197>.” Journal of Finance, 78(1), 487–557.
Examples
## Load the example data
data("BFactor_zoo_example")
HML <- BFactor_zoo_example$HML
lambda_ols <- BFactor_zoo_example$lambda_ols
R2.ols.true <- BFactor_zoo_example$R2.ols.true
sim_f <- BFactor_zoo_example$sim_f
sim_R <- BFactor_zoo_example$sim_R
uf <- BFactor_zoo_example$uf
## If the user aims to convert \eqn{\psi} to the prior Sharpe ratio:
print(psi_to_priorSR(sim_R, sim_f, priorSR=0.1))
## If the user wants to convert the prior Sharpe ratio to \eqn{\psi}:
psi0_to_map <- psi_to_priorSR(sim_R, sim_f, priorSR=0.1)
print(psi_to_priorSR(sim_R, sim_f, psi0=psi0_to_map))
## If we enter both psi0 and priorSR (or forget to input them simultaneously),
## a warning will be printed:
print(psi_to_priorSR(sim_R, sim_f))
print(psi_to_priorSR(sim_R, sim_f, priorSR=0.1, psi0=2))