9.5 Exercises
Show that the posterior distribution of β∣σ2,D is N(βn,Bn), where Bn=(B−10+∑Ni=1X⊤iV−1iXi)−1, βn=Bn(B−10β0+∑Ni=1X⊤iV−1iyi).
The relation between productivity and public investment example continues
- Perform inference of this example using our GUI.
- Program from scratch a Gibbs sampling algorithm to perform this application. Set β0=05, B0=I5, α0=δ0=0.001, d0=5 and D0=I1.
- Perform inference in this example assuming that μit∣τit∼N(0,σ2/τit) and τit∼G(v/2,v/2) setting v=5.
Simulation exercise of the longitudinal normal model continues
Assume that yit=β0+β1xit1+β2xit2+β3xit3+β4zi1+bi+wit1bi1+μit, where xitk∼N(0,1), k=1,2,3, zi1∼B(0.5), wit1∼N(0,1), bi∼N(0,0.71/2), bi1∼N(0,0.61/2), μit∼N(0,0.11/2), β=[0.5,0.4,0.6,−0.6,0.7]⊤, i=1,2,…,50, and the sample size is 2,000 in an unbalanced panel structure. In addition, we assume that bi depends on zi=[1,zi1]⊤ such that bi∼N(Ziγ,D) where Zi=IK2⊗z⊤i, and γ=[1,1,1,1]. The prior for γ is N(γ0,Γ0) where we set γ0=04 and Γ0=I4.
- Perform inference in this model without taking into account the dependence between bi and zi1, and compare the posterior estimates with the population parameters.
- Perform inference in this model taking into account the dependence between bi and zi1, and compare the posterior estimates with the population parameters.
Doctor visits in Germany continues I
Replicate this example using our GUI, which by default does not fix the over-dispersion parameter (σ2), and compare the results with the results of this example in Section 9.2.
Simulation exercise of the longitudinal logit model
Perform a simulation exercise to assess the performance of the hierarchical longitudinal logit model. The point of departure is to assume that y∗it=β0+β1xit1+β2xit2+β3xit3+bi+wit1bi1, where xitk∼N(0,1), k=1,2,3, wit1∼N(0,1), bi∼N(0,0.71/2), bi1∼N(0,0.61/2), β=[0.5,0.4,0.6,−0.6]⊤, i=1,2,…,50, and yit∼B(πit), where πit=11+exp(y∗it). The sample size is 1,000 in an unbalanced panel structure.
- Perform inference using the command MCMChlogit fixing the over-dispersion parameter, and using β0=04, B0=I4, α0=δ0=0.001, d0=2, and D0=I2.
- Program from scratch a Metropolis-within-Gibbs algorithm to perform inference in this simulation.
Doctor visits in Germany continues II
Take a sub-sample of the first 500 individuals of the dataset 9VisitDoc.csv to perform inference in the number of visits to doctors (DocNum) with the same specification of the example of Doctor visits in Germany in Section 9.2.