Bayes hw2

Problem 1: Savage Density Ratio Method
For this problem, use the file FF-3fac-mon.csv.
a) You regress the size factor (smb) Small-Minus-Big on the excess return on the market using the period 2011-2020, T = 108 observations.
Rsmb,t =a+bXRM,t +et, et~N(0,s) [1] where XRM is the excess return on the market index. As SMB is a long short, you suspect its beta is
small. But you want computes the odds ratio that is it zero (vs non zero !).
• Give the OLS estimate, t-statistic, p-value, for b, and other parameters below
OLS t-statistic p-value β
b) You will compute the posterior odds BF0/1 of the restricted vs unrestricted model by the Savage Density Ratio method. You use the standard conjugate Normal – IGt prior. Specifically the vector b
= (a,b) contains the intercept a and the slope b in [1] is normal given σ. You only care about the slope but need to specify a prior for the entire vector obviously.
Your prior is: b | σ ∼ ( (0, 0) , s2A-1), where A = (X’X)/g , a g-prior with mean vector 0. You choose g to correspond to a prior notional sample size T0 = T / 5 .
c) Your prior for σ is the standard ItG ∼ (ν0 = 4 , ν0 s02). Choose s0 to be the sample estimate of the standard deviation of SMB for 2010. This is in the spirit of Bayesian updating, and consistent with your prior belief that β = 0. What is your s0?
d) Write the formula for your marginal univariate prior density for p(b) the slope coefficient as a function of the prior parameters. This is the formula you will use to compute the Savage Density

Programming Help
Ratio. Make sure to refer to the needed element of the (X’X)-1 matrix, like (X’X)-1[i,j]. You must use AZ’s formulas to write the normalization constants, the parameters, and the pdf.
What type of density is p(β)?
Give its parameters h (in AZ’s equation), μ and ν (formula and numerical value):
Write the equation of p(β), Use numbers for everything that can be replaced by a number.
Computer Science Tutoring
e) Do the same thing for the univariate marginal posterior density p(b|D) of the slope coefficient. Write the theoretical formulas for, and then compute the posterior parameters: ν1, ν1s12, and h (to use for AZ’s pdf equation).
Write the formula for the posterior pdf p(β | D).
程序代写 CS代考 加微信: cstutorcs
f) On Figure 1, plot the posterior and the prior pdf for β. Put a vertical line at β = 0.
g) Compute the Bayes Factor. What do you conclude, compare with the p-value.

Problem 2: The Basic regression by Gibbs Sampling !
a) Write the joint posterior p(β , σ ∣ D) for the linear regression with normal errors and diffuse prior.
b) Looking a this joint posterior, “recognize in it” the conditional density p( β | σ, D). Write it.
c) Clearly, a) b) are free points for anybody who can read their notes. Let’s do a bit of thinking. Looking at the joint posterior again “recognize in it” the conditional density p(σ | β , D). Write it below, what is it, name, parameters?

d) This is fun. We can estimate the regression by Gibbs sampling of p(β | σ, D) and p(σ | β, D). Let’s do the same regression and data as problem 1, but a diffuse prior this time.
Start your first draw of the β vector at (0.10,2.0). These are obviously completely unrealistic values!. Do 10,100 draws of the Gibbs sampler for α, β, σ.
In Figure 1, plot the time series of your first 50 draws for the 3 parameters (3 plots). How many draws does it take to eliminate the initial conditions?
e) Report the following sample statistics of your algorithm, after “throwing out” the first 100 draws. a-ann β σ
Std. Dev [0.25,0.75] ACF(1) ACF(10) RNE
Use Numeff to get the numerical efficiency (RNE).