Answered>Order 19200

Hi,

Can I request you to please help me with R code for below listed questions :

1) Show that the gamma distribution is a conjugate prior for the exponential distribution. Suppose that the waiting time in a queue is modeled as an exponential random variable with unknown parameter?, and that the average time to serve a random sample of 20 customers is 5.1 minutes. A gamma distribution is used as a prior. Consider two cases: (1) the mean of the gamma is 0.5 and the standard deviation is 1, and (2) the mean is 10 and the standard deviation is 20. Plot the two posterior distributions and compare them. Find the two posterior means and compare them. Explain the differences.

2) The data of this exercise were gathered as part of a study to estimate the population size of the bowhead whale (Raftery and Zeh 1993). The statistical procedures for estimating the population size along with an assessment of the variability of the estimate were quite involved, and this problem deals with only one aspect of the problem—a study of the distribution of whale swimming speeds. Pairs of sightings and corresponding locations that could be reliably attributed to the same whale were collected, thus providing an estimate of velocity for each whale. The velocities,v1,v2,…,v210(km/h), were converted into timest1,t2,…,t210 to swim 1 km—t i /vi. The distribution of the t i was then fit by a gamma distribution. The times are contained in the filewhales. a.Make a histogram of the 210 values oft i. Does it appear that a gamma distribution would be a plausible model to fit? b.Fit the parameters of the gamma distribution by the method of moments. c. Fit the parameters of the gamma distribution by maximum likelihood. How do these values compare to those found before? d.Plot the two gamma densities on top of the histogram. Do the fits look reasonable? e. Estimate the sampling distributions and the standard errors of the parameters fit by the method of moments by using the bootstrap. f. Estimate the sampling distributions and the standard errors of the parameters fit by maximum likelihood by using the bootstrap. How do they compare to the results found previously? 8.10 Problems 323 g. Find approximate confidence intervals for the parameters estimated by maximum likelihood.

3) Suppose that X is a discrete random variable with P()=(2/3 )*? P()=(1/3)*? P()=(2/3)*(1??) P()=(1/3)*(1??) where 0?? ?1 is a parameter. The following 10 independent observations were taken from such a distribution:(3,0,2,1,3,2,1,0,2,1). a) If the prior distribution of is uniform on [0,1], what is the posterior density? Plot it. What is the mode of the posterior?

Please note that I just need R code for all three problems .Can you arrange for the answers by today evening ?

Thanks,

Indu

 
"Not answered?"
Get the Answer