首页 > > 详细

讲解php程序、php讲解、RMarkdown辅导

Turn in a cleanly organized RMarkdown le along with the output (in any format you want). Clearly
denote the results of each question! If the grader has a hard time nding your answer, I will instruct them
to not give you credit! Make it easy for them!
All data for the book problems can be downloaded from
http://www.highstat.com/index.php/a-beginner-s-guide-to-r
Book Problems: A Beginner’s Guide to R (available online through the library),
Chapter 2, Problems 1,2,5,6
Chapter 3, Problems 2
Written Problems:
1. Consider the density:
f(x) = x 2e x2=2 2 ; x 0;
where 2 > 0 is a xed parameter.
(a) Show that this is a valid density.
(b) Compute the CDF and its inverse.
(c) Simulate 1000 iid random variables from this density with 2 = 2 using the inverse-CDF method.
Plot a histogram of the resulting realizations together with a curve of the density function f(z).
(d) We are now going to set up an accept/reject simulation approach. Still assume that 2 = 2.
i. Suppose the candidate distribution, g, we are going to use to simulate from f is an exponential
with rate =1. Find a value of c such that
sup
x 0
f(x)
g(x) c<1:
You must establish this inequality mathematically.
ii. Using a while loop and the accept/reject approach, simulate 1000 iid draws from f using g
(exponential with rate 1) to generate candidates. Report how many total iterations it took
to produce the sample and construct a histogram analagous to the one is (c).

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!