Please use set.seed(422) and provide R code
Posted: Tue Apr 26, 2022 6:15 pm
Please use set.seed(422) and provide R code
Problem 1. Dr. Lee wants to find an upper-tail critical value of chi-squared distribution but he doesn't remember the whole probability density function (pdf). Luckily, he remembers the pdf of the chi-squared distribution up to some constant, 2 k f(x) < x2-12-ลน, x > 0. e = 1. (20 pts) Use the Metropolis-Hastings algorithm to generate a random sample of size 10,000 from the chi-squared distribution with 5 degrees of freedom (k = 5). Find 95th percentile (or quantile) of your sample which can be used as upper-tail critical value when the significance level is 0.05. (Hint: Use the log-normal distribution (meanlog 0, sdlog Xt) as proposal dis- tribution. To calculate the log-normal density, use dlnorm(x, meanlog, sdlog). To generate sample from the log-normal density, use rlnorm(n, meanlog, sdlog).) = =
Problem 1. Dr. Lee wants to find an upper-tail critical value of chi-squared distribution but he doesn't remember the whole probability density function (pdf). Luckily, he remembers the pdf of the chi-squared distribution up to some constant, 2 k f(x) < x2-12-ลน, x > 0. e = 1. (20 pts) Use the Metropolis-Hastings algorithm to generate a random sample of size 10,000 from the chi-squared distribution with 5 degrees of freedom (k = 5). Find 95th percentile (or quantile) of your sample which can be used as upper-tail critical value when the significance level is 0.05. (Hint: Use the log-normal distribution (meanlog 0, sdlog Xt) as proposal dis- tribution. To calculate the log-normal density, use dlnorm(x, meanlog, sdlog). To generate sample from the log-normal density, use rlnorm(n, meanlog, sdlog).) = =