To model the variable selection procedure, we introduce a vector of binary latent variables \(\gamma^\top = (\gamma_0,\gamma_1,...,\gamma_K)\),
where \(\gamma_j \in \{0,1\} \). When \(\gamma_j = 1\), factor \(j\) (with associated loadings \(C_j\)) should be included
in the model and vice verse.
The continuous spike-and-slab prior of risk prices \(\lambda\) is
$$ \lambda_j | \gamma_j, \sigma^2 \sim N (0, r(\gamma_j) \psi_j \sigma^2 ) .$$
When the factor \(j\) is included, we have \( r(\gamma_j = 1)=1 \).
When the factor is excluded from the model, \( 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 \(r\) is 0.001).
If intercept = TRUE, we choose \( \psi_j = \psi \tilde{\rho}_j^\top \tilde{\rho}_j \),
where \( \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 \(j\)'s correlations with asset returns.
Instead, if intercept = FALSE, we choose \( \psi_j = \psi \rho_j^\top \rho_j \).
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
\(\pi (\gamma_j = 1 | \omega_j) = \omega_j \). Following the literature on the variable selection, we set
$$ \pi (\gamma_j = 1 | \omega_j) = \omega_j, \ \ \omega_j \sim Beta(a_\omega, b_\omega) . $$
Different hyperparameters \(a_\omega\) and \(b_\omega\) determine whether one a priori favors more parsimonious models or not.
We choose \(a_\omega = 1\) (aw) and \(b_\omega=1\) (bw) as the default values.
For each posterior draw of factors' risk prices \(\lambda^{(j)}_f\), we can define the SDF as
\(m^{(j)}_t = 1 - (f_t - \mu_f)^\top \lambda^{(j)}_f\).The Bayesian model averaging of the SDF (BMA-SDF)
over \(J\) draws is
$$m^{bma}_t = \frac{1}{J} \sum^J_{j=1} m^{(j)}_t.$$