| psi_to_priorSR {BayesianFactorZoo} | R Documentation |
Mapping \psi (psi0) to the prior Sharpe ratio of factors (priorSR), and vice versa.
Description
This function provides the one-to-one mapping between \psi 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
\frac{E_{\pi} [ SR^2_f \mid \gamma, \sigma^2 ] }{E_{\pi} [ SR^2_{\alpha} \mid \sigma^2] } = \frac{\psi \sum^K_{k=1} r(\gamma_k) \tilde{\rho}^\top_k \tilde{\rho}_k }{N},
where SR^2_f and SR^2_{\alpha} denote the Sharpe ratios of all factors (f_t) and of the pricing errors
(\alpha), and E_{\pi} denotes prior expectations.
The prior \pi (\omega) encodes the belief about the sparsity of the true model using the prior distribution
\pi (\gamma_j = 1 | \omega_j) = \omega_j, \ \ \omega_j \sim Beta(a_\omega, b_\omega) . We further integrate out
\gamma_j in E_{\pi} [ SR^2_f \mid \gamma, \sigma^2 ] and show the following:
\frac{E_{\pi} [ SR^2_f \mid \sigma^2 ] }{E_{\pi} [ SR^2_{\alpha} \mid \sigma^2 ] } \approx \frac{a_\omega}{a_\omega+b_\omega} \psi \frac{ \sum^K_{k=1} \tilde{\rho}^\top_k \tilde{\rho}_k }{N}, \ as \ r \to 0 .
Since we can decompose the Sharpe ratios of all test assets, SR^2_R, into SR^2_f and SR^2_{\alpha} (i.e., SR^2_R = SR^2_f + SR^2_{\alpha}), we can
represent SR^2_f as follows:
E_{\pi} [ SR^2_f \mid \sigma^2 ] \approx \frac{\frac{a_\omega}{a_\omega+b_\omega} \psi \frac{ \sum^K_{k=1} \tilde{\rho}^\top_k \tilde{\rho}_k }{N}}{1 + \frac{a_\omega}{a_\omega+b_\omega} \psi \frac{ \sum^K_{k=1} \tilde{\rho}^\top_k \tilde{\rho}_k }{N}} SR^2_R.
We define the prior Sharpe ratio implied by the factor models as \sqrt{E_{\pi} [ SR^2_f \mid \sigma^2 ]}.
Given a_\omega, b_\omega, \frac{ \sum^K_{k=1} \tilde{\rho}^\top_k \tilde{\rho}_k }{N}, and the observed
Sharpe ratio of test assets, we have one-to-one mapping between \psi and \sqrt{E_{\pi} [ SR^2_f \mid \sigma^2 ]}.
If the user aims to convert \psi to the prior Sharpe ratio, she should input only psi0.
In contrast, if she wants to convert the prior Sharpe ratio to \psi, priorSR should be entered.
Value
The return of psi_to_priorSR is:
-
psi0orpriorSR.
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))