Please use set.seed(422) and provide R code

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Please use set.seed(422) and provide R code

Post by answerhappygod »

Please use set.seed(422) and provide R code
Please Use Set Seed 422 And Provide R Code 1
Please Use Set Seed 422 And Provide R Code 1 (263.87 KiB) Viewed 40 times
Problem 2. For the following bivariate density of X and Y, f(x, y) a (*) weta-1 (1 – y)n-2+3–1, x = 0,1,...,n, 0 <y <1, suppose we are interested in estimating the mean of the marginal distribution f(x) of X. It can be shown that for fixed a, B, and n, the conditional densities are f(x[y) is Binomial(n,y) f(y|x) is Beta(x + a, n = x +B). 1. (20 pts) Use the Gibbs sampling to generate a random sample of size 10,000 from the target bivariate density with parameter values n = 16, a = 2, and B = 4. You can initialize first sample with (5, 0). (Hint: Use rbinom() function to generate sample from Binomial distribution and use rbeta() function to generate sample from Beta distribution.) 2. (5 pts) Now to estimate the mean of the marginal distribution f(x) of X, calculate the sample mean of X from the generated random sample. 3. (5 pts) As you may have already noticed, Gibbs sampling is actually not needed in this example, since f(x) can be obtained analytically from the joint density and it follows the beta-binomial distribution. However, Gibbs sampling becomes indispensable in situation where f(x) cannot be obtained analytically. The theoretical mean of the beta-binomial distribution is no antes. Compare the theoretical mean to the sample mean you obtained.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply