Draw the histograms for the posterior distribution

Assignment Help Basic Statistics
Reference no: EM131059296

Problem 1

Consider the data set "Rat_data.csv" (Read the data using the function read.csv()) in R.

Each data point represents the weight of a rat at a certain age. More specifically, weights of 30 rats (in grams) were measured at five time points of x1 = 8, x2 = 15, x3 = 22, x4 = 29, x5 = 36(weeks).

For example, weight of rat 3 in week 15 was 214 grams. Let yij denote the weight of rat i at age xj, and consider the following model for the yij

??ij~??(αi + βi(xj - x¯), σ2) for i = 1, . . . , 30 and j = 1, . . . , 5 and x¯ = 22

(a) Obtain the maximum likelihood estimate of αi , βi and σ2. Show your work, and compute the final estimates

(b) Now consider a Bayesian analysis of this model, where we assume the following priors

αi~??(α, 100) with hyperprior α~??(0,10000)

βi~??(β, 1) with hyperprior β~??(0,10000)

Τ = 1/σ2 ~ gamma(10-3, 10-3)

where αi , βi and Τ are assumed to be independent. Our aim here is to use the Gibbs sampling method to generate values from the posterior distribution of(α1, . . . , α30, β1, . . . , β30, Τ).

(i) State all the required conditionals. Show your derivation very briefly.

(ii) Write a complete algorithm for this Gibbs sampling algorithm, specific to this problem and code your algorithm, using R.

(iii) Run the chain for 50,000 iterations, and burn-in the first 10,000 generated values. Plot the chain (trace) after the burn-in for α1, β1, α15, β15, Τ against the iteration number, and comment on the mixing.

(iv) Draw the histograms for the posterior distribution of α1, β1, α15, β15, Τ and provide a point estimate for each parameter

(c) Obtain a 95% credible interval for each of the parameters α1, β1. Interpret your intervals in the context of the problem.

(d) In the prior, we assumed that αi , βi and Τ are independent. Does the posterior support this assumption? Justify your answer.

Problem 2

Consider simulation of the bivariate normal distribution with μ = (1,2)?? and covariance matrix

Σ = (1    0.9)

      (0.9   1)

using Metropolis-Hastings algorithm with random walk generating density. Specifically, let x* = x(t) + ∈ where ∈~??2(0, D) with D being a diagonal matrix with diagonal elements δ1 and δ2. Note that δ1 and δ2 control the spread of values generated along the first and second coordinate axis, respectively.

(a) Give the M-H algorithm algorithm, and code it in R.

(b) Choose δ1 = 0.001 and δ2 = 0.001, and generate a chain, starting at x(0) = (0, 0)t , of size 10,000 using the M-H algorithm.

(i) Compute the acceptance rate, and comment on the acceptance rate.

(ii) Burn 1000, and draw a trace plot and the density plot for the chain for each of the variables. Comment on mixing and the density plots.

(iii) Draw 9000 pairs generated from multivariate normal with μ = (1,2)?? and covariance matrix

Σ = (1    0.9)

      (0.9   1)

Plot these pairs on a scatterplot overlaying it with the last 9000 points obtained from the M-H chain; use different color for those generated from MH and those directly generated from the target (choosing an alpha-level for color transparency is helpful). Do the M-H generated values match the target? Explain why or why not.

(c) Choose appropriate δ1 and δ2 so that the M-H algorithm would generate values that meet the target requirement. Draw a similar plots as in part b(ii) and b(iii) for this case.

(d) How do you expect the acceptance rate would change, if you choose δ1 and δ2 to be very large? Briefly explain why?

Attachment:- rats_data.csv

Reference no: EM131059296

Questions Cloud

Temperature in the middle : The leftmost end is held at a temperature of 300 and the rightmost end is held at 500 K. What is the temperature in the middle where the two rods meet?
The company variable expenses per unit : Steeler Corporation is planning to sell 120,000 units for $3.10 per unit and will break even at this level of sales. Fixed expenses will be $108,000. What are the company's variable expenses per unit?
Magnitude of the change in velocity : In a fit, a toddler throws straight down his favorite 1.5 kg toy with an initial velocity of 2.9 m/s. What is the magnitude of the change in velocity of the toy from t = 0.25 seconds to t = 0.47 seconds?
How the project might be reorganized : Assume that a serious, unanticipated setback occurs and instead of taking 10 days, task T5 takes 40 days. Draw up new bar charts showing how the project might be reorganized.
Draw the histograms for the posterior distribution : Draw the histograms for the posterior distribution of α1, β1, α15, β15, Τ and provide a point estimate for each parameter - Write a complete algorithm for this Gibbs sampling algorithm
Average force on the nail : 1) A nail gun fires a nail into a piece of wood. The nail is going a velocity of 6.8 m/sright before entering the wood. The mass of the nail is 0.060 kg (a) If the nail is accelerated from rest over a distance of 8.5 cm what is the average force on..
Minimize their federal income tax liability : Jack and Jill are married and have three dependent children, and they file a joint return in 2014. If they wish to minimize their federal income tax liability and have adjusted gross income (AGI) of $90,000 and their itemized deductions are $10,00..
Explain the potential problems with this approach : Explain the potential problems with this approach when software has high performance or dependability requirements. 23.8. A software manager is in charge of the development of a safety-criti
Emf in the short coil during this time : A 550-turn solenoid, 19 cm long, has a diameter of 2.8 cm . A 20-turn coil is wound tightly around the center of the solenoid. If the current in the solenoid increases uniformly from 0 to 3.2 A in 0.21 s , what will be the induced emf in the short..

Reviews

Write a Review

Basic Statistics Questions & Answers

  Statistics-probability assignment

MATH1550H: Assignment:  Question:  A word is selected at random from the following poem of Persian poet and mathematician Omar Khayyam (1048-1131), translated by English poet Edward Fitzgerald (1808-1883). Find the expected value of the length of th..

  What is the least number

MATH1550H: Assignment:  Question:     what is the least number of applicants that should be interviewed so as to have at least 50% chance of finding one such secretary?

  Determine the value of k

MATH1550H: Assignment:  Question:     Experience shows that X, the number of customers entering a post office during any period of time t, is a random variable the probability mass function of which is of the form

  What is the probability

MATH1550H: Assignment:Questions: (Genetics) What is the probability that at most two of the offspring are aa?

  Binomial distributions

MATH1550H: Assignment:  Questions:  Let’s assume the department of Mathematics of Trent University has 11 faculty members. For i = 0; 1; 2; 3; find pi, the probability that i of them were born on Canada Day using the binomial distributions.

  Caselet on mcdonald’s vs. burger king - waiting time

Caselet on McDonald’s vs. Burger King - Waiting time

  Generate descriptive statistics

Generate descriptive statistics. Create a stem-and-leaf plot of the data and box plot of the data.

  Sampling variability and standard error

Problems on Sampling Variability and Standard Error and Confidence Intervals

  Estimate the population mean

Estimate the population mean

  Conduct a marketing experiment

Conduct a marketing experiment in which students are to taste one of two different brands of soft drink

  Find out the probability

Find out the probability

  Linear programming models

LINEAR PROGRAMMING MODELS

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd