Page 1 of 1

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

Posted: Tue Apr 26, 2022 6:15 pm
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 (219.26 KiB) Viewed 34 times
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).) = =