首页 > > 详细

辅导355H1S调试R、R调试、辅导R程序

Final assessment STA355H1S
Instructions:
1. Solutions to problems 1–3 are to be submitted on Quercus (PDF files only) – the
deadline is noon on April 8, 2020.
2. This is an open-book test so you are free to use material from the lectures and other
published sources; in the event that you make use of material that was not covered in
the lectures, you must cite your source or sources. Show all relevant work (including
R code and output, when appropriate) to receive full credit.
3. Obtaining or providing unauthorized assistance (which includes working in groups)
is considered an academic offence as outlined in the University of Toronto’s Code of
Behaviour on Academic Matters.
1. A piece of software contains an unknown number (N) of bugs. To estimate N , the software
is used by m users and each user records the number of bugs observed in their session. Our
data thus consists of x1, · · · , xm, the number of bugs observed by the m users.
Suppose that we can model our data as outcomes of independent Binomial random variables
X1, · · · , Xm with parameters N and θ where both N and θ are unknown parameters:
P (Xi = x;N, θ) =
(
N
x
)
θx(1− θ)N−x for x = 0, · · · , N
Data from m = 54 users is given in a file bugs.txt on Quercus. Use these data to answer
parts (a) and (b).
(a) Use the sample mean and sample variance of x1, · · · , x54 to give method of moments
estimates of θ and N . Give standard error estimates for these two estimates. (In this part,
you may consider N to be a continuous parameter.)
(b) Suppose we put the following prior distribution on N and θ:
pi(N, θ) =
12(1− θ)
pi2N2
for 0 < θ < 1 and N = 1, 2, 3, · · ·
(Note that
∞∑
N=1
∫ 1
0
pi(N, θ) dθ = 1.)
Compute the posterior probability P (N ≥ 10|x1, · · · , x54).
Hint: You may find the following identity useful:∫ 1
0
θa−1(1− θ)b−1 dθ = Γ(a)Γ(b)
Γ(a+ b)
for a, b > 0.
2. Suppose that X1, · · · , Xn are independent positive random variables with common cdf
F (x). The Atkinson index of F is defined by
A(F ) = 1− 1
EF (X)
exp [EF (ln(X))]
(a) Suppose that F is a log-normal distribution, that is, ln(X) ∼ N (µ, σ2). Find an expres-
sion for A(F ). (Hint: This expression will depend only on σ.)
(b) A sample of 200 observations from a distribution F is given in a file incomes.txt on
Quercus. Assuming a log-normal model for these data, give an estimate of A(F ) and an
estimate of its standard error. (There are several approaches to doing this so justify your
method.)
3. Suppose that X1, · · · , X100 are independent Exponential random variables with pdf
f(x;λ) = λ exp(−λx) for x ≥ 0
where λ > 0. However, you do not observe all 100 random variables, only the order statistics
X(20) and X(50).
(a) Suppose you want to estimate µ = Eλ(Xi) = 1/λ using only X(20) and X(50). Consider
estimators of the form
µ̂ = a1X(20) + a2X(50)
for some constants a1 and a2. Show that µ̂ is an unbiased estimator of µ if
a1
20∑
k=1
1
100− k + 1 + a2
50∑
k=1
1
100− k + 1 = 1.
(b) Find the values of a1 and a2 that minimize the variance of µ̂ for a1 and a2 satisfying the
unbiasedness condition in part (a).
Hint: Use the fact that if X1, · · · , Xn are independent Exponential random variables with
pdf f(x;λ) given above then the normalized spacings
Y1 = nX(1), Y2 = (n− 1)(X(2) −X(1)), Y3 = (n− 2)(X(3) −X(2)), · · · , Yn = X(n) −X(n−1)
are independent Exponential random variables with pdf f(x : λ).

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

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