continuous_ss_sdf {BayesianFactorZoo}R Documentation

SDF model selection with continuous spike-and-slab prior

Description

This function provides the SDF model selection procedure using the continuous spike-and-slab prior. See Propositions 3 and 4 in Bryzgalova et al. (2023).

Usage

continuous_ss_sdf(
  f,
  R,
  sim_length,
  psi0 = 1,
  r = 0.001,
  aw = 1,
  bw = 1,
  type = "OLS"
)

Arguments

f

A matrix of factors with dimension t×kt \times k, where kk is the number of factors and tt is the number of periods;

R

A matrix of test assets with dimension t×Nt \times N, where tt is the number of periods and NN is the number of test assets;

sim_length

The length of monte-carlo simulations;

psi0

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

r

The hyper-parameter related to the prior of risk prices (see Details);

aw

The hyper-parameter related to the prior of γ\gamma (see Details);

bw

The hyper-parameter related to the prior of γ\gamma (see Details);

type

If type = 'OLS' (type = 'GLS'), the function returns Bayesian OLS (GLS) estimates of risk prices. The default is 'OLS'.

Details

To model the variable selection procedure, we introduce a vector of binary latent variables γ=(γ0,γ1,...,γK)\gamma^\top = (\gamma_0,\gamma_1,...,\gamma_K), where γj{0,1}\gamma_j \in \{0,1\} . When γj=1\gamma_j = 1, factor jj (with associated loadings CjC_j) should be included in the model and vice verse.

The continuous spike-and-slab prior of risk prices λ\lambda is

λjγj,σ2N(0,r(γj)ψjσ2). \lambda_j | \gamma_j, \sigma^2 \sim N (0, r(\gamma_j) \psi_j \sigma^2 ) .

When the factor jj is included, we have r(γj=1)=1 r(\gamma_j = 1)=1 . When the factor is excluded from the model, r(γj=0)=r1 r(\gamma_j = 0) =r \ll 1 . Hence, the Dirac "spike" is replaced by a Gaussian spike, which is extremely concentrated at zero (the default value for rr is 0.001). We choose ψj=ψρ~jρ~j \psi_j = \psi \tilde{\rho}_j^\top \tilde{\rho}_j , where ρ~j=ρj(1NΣi=1Nρj,i)×1N \tilde{\rho}_j = \rho_j - (\frac{1}{N} \Sigma_{i=1}^{N} \rho_{j,i} ) \times 1_N is the cross-sectionally demeaned vector of factor jj's correlations with asset returns. In the codes, ψ\psi is equal to the value of psi0.

The prior π(ω)\pi (\omega) encoded the belief about the sparsity of the true model using the prior distribution π(γj=1ωj)=ωj\pi (\gamma_j = 1 | \omega_j) = \omega_j . Following the literature on the variable selection, we set

π(γj=1ωj)=ωj,  ωjBeta(aω,bω). \pi (\gamma_j = 1 | \omega_j) = \omega_j, \ \ \omega_j \sim Beta(a_\omega, b_\omega) .

Different hyperparameters aωa_\omega and bωb_\omega determine whether one a priori favors more parsimonious models or not. We choose aω=1a_\omega = 1 (aw) and bω=1b_\omega=1 (bw) as the default values.

For each posterior draw of factors' risk prices λf(j)\lambda^{(j)}_f, we can define the SDF as mt(j)=1(ftμf)λf(j)m^{(j)}_t = 1 - (f_t - \mu_f)^\top \lambda^{(j)}_f.The Bayesian model averaging of the SDF (BMA-SDF) over JJ draws is

mtbma=1Jj=1Jmt(j).m^{bma}_t = \frac{1}{J} \sum^J_{j=1} m^{(j)}_t.

Value

The return of continuous_ss_sdf is a list of the following elements:

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

## sim_f: simulated strong factor
## uf: simulated useless factor

psi_hat <- psi_to_priorSR(sim_R, cbind(sim_f,uf), priorSR=0.1)
shrinkage <- continuous_ss_sdf(cbind(sim_f,uf), sim_R, 5000, psi0=psi_hat, r=0.001, aw=1, bw=1)
cat("Null hypothesis: lambda =", 0, "for each factor", "\n")
cat("Posterior probabilities of rejecting the above null hypotheses are:",
    colMeans(shrinkage$gamma_path), "\n")

## We also have the posterior draws of SDF: m(t) = 1 - lambda_g %*% (f(t) - mu_f)
sdf_path <- shrinkage$sdf_path

## We also provide the Bayesian model averaging of the SDF (BMA-SDF)
bma_sdf <- shrinkage$bma_sdf


[Package BayesianFactorZoo version 0.0.0.2 Index]