Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

STA261H1S Term Test 2  (Wed Evening)

2022

Question 1

(a)  [5 Marks] A two sided 95% confidence interval for µ in the location Normal model N(µ, σ0(2)), calculated from a an observed sample is (54, 66). ( Note: sample size is not given to you)

Calculate the lower limit of the 90% confidence interval for µ, using the data from the same sample.

Solution

 =  =  = 60

z(1+0.90)/2  = 1.64

ME = U L  = 66 54  = 6

σ0              ME  = 3.0612245

Lower limit of the 90% confidence interval

N(=)ot(x¯)do(.90)t(2)ed(=) n(6)0 fo(4)r(×)th(3.)ti(5)

 

(b)  [8 Marks] Using R, I generated a sample of 49 observations from a Poisson(λ) distribution and calculated an approximate two sided 95% confidence interval for λ using the approximation based on the central limit theorem.  The lower limit of this confidence interval is L =  1.64. Calculate the upper limit of this confidence interval.

Solution

L =  − z   =⇒   − L = 0


Question 2

Suppose a sample of n  =  10  employees were collected from a company and their income  (in $1000) was reported.  The incomes were s = 4.00, 5.26, 4.84, 6.77, 5.23, 5.64, 3.84, 6.43, 3.35, 4.28 ∼ N(µ, σ2 ), with both µ and σ unknown.

(a)  [5 Marks] Estimate the population average income µ and the 80% confidence interval.

 

Solution:

> gam = 0.8

> barx <- mean(x); sx <- sd(x)

> barx; sx

[1] 4.964086

[1] 1.122237

> SE <- sx/sqrt(length(x))

> barx - qt((1+gam)/2, df = length(x) - 1) * SE

[1] 4.473273

>

> barx + qt((1+gam)/2, df = length(x) - 1) * SE

[1] 5.454898

The mean,  = 4.96; the SD, s = 1.12, Lower limit = 4.47 and upper limit = 5.45 (Please check if this solution is right before marking)

(b)  [4 Marks] Perform a two sided test to test H0  : µ = 6 at α = 0.1.

 

Solution:

> alph <- 0.1

> t.cal <- sqrt(n) * (barx - mu0)/ sx

> p.val <- 2 * (1 - pt(abs(t.cal), df = length(x) - 1))

> t.cal; p.val

[1] -2.919034

[1] 0.01705861

> ## Critical Value ##

> qt(alph, df = length(x) - 1)

[1] -1.383029

> t.test(x, alternative =  "two.sided", mu = mu0)

One Sample t-test

data: x

t = -2.919, df = 9, p-value = 0.01706

alternative hypothesis: true mean is not equal to 6

95 percent confidence interval:

4.161286 5.766886

sample estimates:


mean of x

4.964086

We reject the H0  at α = 0.1. Students can make the decision based on p-value or the critical t. Note: To receive full marks you need to show full calculation for both (a) and (b)


Question 3

Suppose that x = (1, 0, 1, 0, 1) is an observed sample from Bernoulli(θ) distribution and the prior

distribution of θ has p.d.f.:

π(θ) = {0(4)θ3 ,

(a)  [5 Marks] Calculate the posterior expectation of θ .

Solution: Note that the prior distribution of θ is beta(4,1) and thus the posterior distribution is beta(4+3 = 7, 5 - 3 + 1 = 3)

π(θ | s) = θ6 (1 θ)2

Thus, the posterior expectation of θ 2 ,

E(θ | s) =   θ 7 (1 θ)2 dθ =   = 0.7

Note for TA: Please check for any potential error in the solution.

(b)  [5 Marks] Calculate the posterior variance of  .

Solution: Thus, the posterior variance of 1/θ ,

E(θ−1  | s) =   θ 5 (1 θ)2 dθ =   = 1.5

E(θ−2  | s) =   θ4 (1 θ)2 dθ =   = 2.4 Thus, the variance, V ( ) = E(θ−2  | s) E(θ−1  | s)2  = 0.15


Question 4

(a)  [5 Marks] I generated a sample from a location Normal model with σ0(2)  = 400.  The two sided

95% confidence interval for the mean (µ) calculated using this sample I generated is (60, 70). This interval has all the information necessary to test the null hypothesis H0  : µ = 62 against the alternative H1   : µ  > 62.  Calculate the value of the observed z-statistic and the p-value for the z-test of the null hypothesis H0  : µ = 62 against the alternative H1  : µ > 62. Assume α = 0.05

Solution: The 95% confidence interval for the mean (µ) calculated using this sample I gener-

ated is (60, 70)  =⇒ SE =  = 2    = 2.55102

 =  = 65

z = 0    =  265(5)102(62)  = 1 . 176  (4 points)

p-value = P (Z > 1.59) = 0 . 1197974 (2 point)     

 

(b)  [3 Marks] Calculate the number of observations in this study.

Solution: Let the number of observations = n. We know that

SE = σ0 / n = 2.55102 n = (σ0 /2.55102)2  = 61 62


Question 5

A Biologists is interested in the proportion, θ of badgers in a particular area which carry the infection responsible for bovine tuberculosis.   The prior distribution of θ  is Beta(1, 19).   The biologists captures a random sample of 20 badgers and tests them for infections.  The observed number of

infections were 2. Assume that the

(a)  [4 Marks] Find the prior mean and prior mode of θ .

Solution:  This is a Bernoulli-Beta combination.  The prior distribution of θ is a Beta distri-

bution with α = 1 and β = 19. Thus the mean 1/20 and mode 12  = 0.           (b)  [6 Marks] Find the posterior mean and posterior mode for the distribution of θ .

Solution:  The posterior distribution is also a Beta distribution with parameters α  =  1 +

n, β =  19 + n(1 − ) ⇒ α = 1 + 2, β = 19  + (20 − 2) ⇒ α = 3, β = 37.  Thus, the posterior