Question: Consider the trivariate random vector ( Y 1 , Y 2 , Y 3 ) with the density f ( y 1 , y 2
Consider the trivariate random vector with the density
exp;
where is the normalizing constant so that the density integrates to
Problem a points
Obtain the distribution of conditional densities of for all possible distinct values of Show
your work.
Problem b points
Implement the Gibbs sampling algorithm to generate values from the joint density of Specifically,
run a chain with points, and burn the first initially generated values. Then, print the approximation
for the mean and covariance matrix of based on your generated sample. Also, plot the histogram
of the marginals distribution of only superimposed by a smoothed density curve. Set breaks for the
histogram, and use the density function for the density curve to be superimposed.
Problem c points
Apply the MetropolisHastings algorithm to generate values from using a chain with points.
Set the proposal density to the trivariate normal density with covariance matrix equal to two times the
identity matrix ie Your code should implement the following:
Use the mvrnorm function in the package MASS to generate multivariate normal values.
Begin your simulation with seed
Start with the initial value
Your code should compute the acceptance rate and print it at the end.
Burn the first points from the chain, and plot the histogram of the marginals of and
superimposed by a smoothed density curve. Set breaks for the histogram, and use the density
function for the density curve to
be superimposed.
need rcode.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
