Learn R Programming

BayesianFactorZoo (version 0.0.0.3)

psi_to_priorSR: 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 bryzgalova2023bayesian;textualBayesianFactorZoo.

Usage

psi_to_priorSR(R, f, psi0 = NULL, priorSR = NULL, aw = 1, bw = 1)

Value

The return of psi_to_priorSR is:

  • psi0 or priorSR.

Arguments

R

A matrix of test assets with dimension \(t \times N\), where \(t\) is the number of periods and \(N\) is the number of test assets;

f

A matrix of factors with dimension \(t \times k\), where \(k\) is the number of factors and \(t\) is the number of periods;

psi0

The hyper-parameter in the prior distribution of risk prices (see Details in the function continuous_ss_sdf);

priorSR

The prior Sharpe ratio of all factors (see Details);

aw

The hyper-parameter in the prior of \(\gamma\) (default value = 1, see Details);

bw

The hyper-parameter in the prior of \(\gamma\) (default value = 1, see Details);

Details

According to equation (27) in bryzgalova2023bayesian;textualBayesianFactorZoo, 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.

References

bryzgalova2023bayesianBayesianFactorZoo

Examples

Run this code

## 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))



Run the code above in your browser using DataLab