Some Assorted Formulae s - utstat.utoronto.cautstat.utoronto.ca/hadas/STA248/Test/mtsol2006.pdfSome...

8

Click here to load reader

Transcript of Some Assorted Formulae s - utstat.utoronto.cautstat.utoronto.ca/hadas/STA248/Test/mtsol2006.pdfSome...

Page 1: Some Assorted Formulae s - utstat.utoronto.cautstat.utoronto.ca/hadas/STA248/Test/mtsol2006.pdfSome test statistics: zobs = x 0 ˙= p n tobs = x 0 s= p n 1. 1. ... Explain. Method

STA 248S MIDTERM TEST March 7, 2006

LAST NAME: SOLUTIONS FIRST NAME:

STUDENT NUMBER:

INSTRUCTIONS:• Time: 1 hour and 50 minutes• Aids allowed: calculator• Tables of the standard normal, t and chi-square distributions are on the last 3 pages (pages 9,10, 11).• Total points: 48

Some Assorted Formulae

Some confidence intervals:

x± zα/2

σ√n

x± tn−1;α/2

s√n

p̂± zα/2

p̂(1− p̂)

n(

(n− 1)s2

χ2n−1;α/2

,(n− 1)s2

χ2n−1;1−α/2

)

Some test statistics:

zobs =x− µ0

σ/√

n

tobs =x− µ0

s/√

n

1

Page 2: Some Assorted Formulae s - utstat.utoronto.cautstat.utoronto.ca/hadas/STA248/Test/mtsol2006.pdfSome test statistics: zobs = x 0 ˙= p n tobs = x 0 s= p n 1. 1. ... Explain. Method

1. (3 marks) Below are three statements about three different datasets. For each statement,describe a feature of the distribution of the data that could make the statement true.

(a) The median is smaller than the mean.Distribution is right-skewedorhas a large outlier.

(b) The trimmed mean is larger than the mean.Has a large negative outlier.

(c) The standard deviation is not an appropriate measure of spread.The distribution is non-symmetric or has outliers (so the mean is not a good measure ofthe centre.

2. X1, X2, . . . , X20 are independent and identically distributed random variables with E(Xi) = 1and Var(Xi) = 5 for i = 1, . . . , 20. Let X =

∑20i=1 Xi / 20.

(a) (1 mark) What is E(X)?1

(b) (1 mark) What is Var(X)?1

4

(c) (2 marks) Suppose µ = E(Xi) is unknown and the goal is to estimate it. Two possibleestimators are X1 and X. Give two reasons why X is a better estimator of µ than X1.Any 2 of:- X is consistent but X1 is not- X has smaller variance than X1

- the distribution of X is approximately normal even if the distribution of the originaldata isn’t so can use normal distribution for inferences

(d) (2 marks) Suppose the data x1, x2, . . . , x20 are observed. Do you have enough informationto find the method of moments estimate of µ = E(Xi)? Do you have enough informationto find the maximum likelihood estimate of µ = E(Xi)? Explain.Method of Moments: yes, µ̂ is the sample meanMaximum Likelihood: no, need the density or mass function of the Xi

2

Page 3: Some Assorted Formulae s - utstat.utoronto.cautstat.utoronto.ca/hadas/STA248/Test/mtsol2006.pdfSome test statistics: zobs = x 0 ˙= p n tobs = x 0 s= p n 1. 1. ... Explain. Method

3. Let X1, X2, . . . , Xn be a random sample from a Bernoulli distribution with probability ofsuccess p unknown. The probability mass function for a Bernoulli random variable is

P (X = x) =

p if x = 11− p if x = 00 otherwise

and E(Xi) = p and Var(Xi) = p(1− p) for i = 1, . . . , n.

Let Y =∑n

i=1 Xi. The distribution of Y is Binomial with probability mass function

P (Y = y) =

(

ny

)

py(1− p)n−y for y = 0, 1, . . . , n

and E(Y ) = np and Var(Y ) = np(1− p).

(a) (4 marks) Show that the maximum likelihood estimate of p is p̂ = Yn .

Likelihood function:(

ny

)

py(1− p)n−y

Log-likelihood function:

L(p) = log

(

ny

)

+ y log(p) + (n− y) log(1− p)

L′(p) =y

p− n− y

1− p

which is zero whenp̂ =

y

n

(b) (2 marks) Show that p̂ = Yn is an unbiased estimator of p.

E(p̂) =E(Y )

n=

np

n= p

(c) (2 marks) The distribution of p̂ = Yn is often approximated with a Normal distribution.

Why is this a reasonable approximation?Y is the sum of n Bernoulli random variables so p̂ is the average of Bernoulli ran-dom variables and the Central Limit Theorem states that averages of random variablesare approximately normally distributed, no matter what the distibution of the individualrandom variables is.

3

Page 4: Some Assorted Formulae s - utstat.utoronto.cautstat.utoronto.ca/hadas/STA248/Test/mtsol2006.pdfSome test statistics: zobs = x 0 ˙= p n tobs = x 0 s= p n 1. 1. ... Explain. Method

4. A poll of 1502 adults in the U.S. conducted in December for Princeton Survey Researchfound that 62% of those surveyed were in favour of the death penalty for persons convictedof murder. The margin of error was quoted as “plus or minus 2.5 percentage points 19 timesout of 20”.

(a) (2 marks) Show how the margin of error of 2.5 is obtained.Margin of error is calculated at value of p that maximizes it (which is 0.5), so the marginof error is

1.96

0.5(1 − .05)

1502= 0.025

where the 1.96 is the 0.975 quantile from a standard Normal distribution since the con-fidence level is 95% (“19 times out of 20”).(OK if use p̂ = 0.62 in formula which gives 0.0245.)

(b) (2 marks) What happens “19 times out of 20”?We want the confidence interval to capture p, the proportion of all U.S. adults in favourof the death penalty. The procedure used captures p within the margin of error of theestimate in 95% (19 of 20) of all possible samples of 1502 adults.

5. A dataset studied by William Gossett (who derived the t-distribution) contained the heightand left-middle-finger measurements of 3000 criminals. He examined properties of samplingdistributions by considering samples from these data.

(a) (2 marks) Suppose a sample of 4 of these criminals had an average height of 67.5 incheswith a standard deviation of 2.54. From this sample, find a 95% confidence interval forthe mean height of the population of criminals.t0.025,3 = 3.18267.5 ± 3.182(2.54/2) = (63.46, 71.54)

(b) (1 mark) Suppose that the mean height at the time Gosset did his work was 70 inches.Based on your confidence interval, does it seem that the criminals were shorter on averagethan the general population? Explain.No. Since 70 is within the confidence interval the data are consistent with a mean heightof 70 inches.

4

Page 5: Some Assorted Formulae s - utstat.utoronto.cautstat.utoronto.ca/hadas/STA248/Test/mtsol2006.pdfSome test statistics: zobs = x 0 ˙= p n tobs = x 0 s= p n 1. 1. ... Explain. Method

6. In 1878 Charles Darwin recorded some data on the heights of Zea mays plants to determinewhat effect cross-fertilized or self-fertilized had on the height of the plants. He selected onecross-fertilized plant and one self-fertilized plant and grew them in the same pot. He wasinterested in whether the two fertilization methods resulted in plants with the same meanheight. The data are the differences in the heights of the two plants grown by Darwin in 15pots. The differences were calculated as cross-fertilized plant height less self-fertilized plantheight and the mean difference was x = 2.6167 inches with a standard deviation of s = 4.718inches.

(a) (1 mark) What are the null and alternative hypotheses for an appropriate statisticaltest?H0 : µ = 0 versus Ha : µ 6= 0 where µ is the mean difference in the heights of 2 plants(one cross-fertilized and one self-fertilized) grown in the same plot

(b) (2 marks) Calculate the value of the test statistic.tobs = 2.6167/(4.718/

√15) = 2.15

(c) (1 mark) Estimate the p-value as accurately as you can.From the t-table with 14 degrees of freedom, 2(0.01) < p < 2(0.025) or 0.02 < p < 0.05.

(d) (1 mark) What is the rejection region if the test is carried out at the α = 0.01 signficancelevel?The 0.005 quantile of the t14 distribution is 2.977 so the rejection region is all valueslarger than 2.977 and less than −2.977.

(e) (2 marks) Do the p-value and rejection region result in the same conclusion? Explain.The rejection region requires strong evidence to reject H0 because the significance levelhas been set at 0.01 and the test statistic is not in the rejection region.The p-value gives only moderate evidence against H0.

5

Page 6: Some Assorted Formulae s - utstat.utoronto.cautstat.utoronto.ca/hadas/STA248/Test/mtsol2006.pdfSome test statistics: zobs = x 0 ˙= p n tobs = x 0 s= p n 1. 1. ... Explain. Method

QUESTION 6 CONTINUES ...

(f) (2 marks) Based on your answer to part (d) on the previous page, what type of error(Type I or Type II) may have been made? Explain in a practical way (related to thegrowth of plants) what it means to make such an error.Since test statistic is not in the rejection region, conclusion would be to not reject H0 sowe could possibly be making a Type II error. That is, we are concluding that there is nodifference in mean heights of the plants fertilized the two different ways, when there isindeed a difference in their mean heights.

(g) (2 marks) The boxplot below is for the data for this question.

−5

05

10

Differences in heights of cross− and self−fertilized plants

Why aren’t the whiskers the same length?The whiskers extend to the furthest data points that are within 1.5*IQR beyond the edgesof the box. So there is a positive data point within these limits further out from the boxthan the data points that are negative.

6

Page 7: Some Assorted Formulae s - utstat.utoronto.cautstat.utoronto.ca/hadas/STA248/Test/mtsol2006.pdfSome test statistics: zobs = x 0 ˙= p n tobs = x 0 s= p n 1. 1. ... Explain. Method

QUESTION 6 CONTINUES ...

(h) (7 marks) Here is some code from R where the variable diff is the differences betweenthe heights of the cross- and self-fertilized plants.

> bootsamples = matrix(sample(diff,15000,replace=T),nrow=1000)

> bootvariances = apply(bootsamples,1,var)

> bootvardiff = sort(bootvariances-mean(bootvariances))

> var(diff)-bootvardiff[950]

[1] 6.856021

> var(diff)-bootvardiff[50]

[1] 36.75781

A bootstrap procedure is being carried out. Explain what is being carried out, in par-ticular:(i) is it a parametric or non-parametric bootstrap procedure?(ii) how many bootstrap samples are being drawn?(iii) what exactly is being calculated and what is the result?(iv) why would the choice be made to use the bootstrap rather than an alternativeprocedure that doesn’t require bootstrap sampling?

(i) non-parametric(ii) 1000(iii) 90% confidence interval for the variance of diffResult: (6.86, 37.76)(iv) Can use the bootstrap when the sampling distribution of the variance is unknown, forexample when the data aren’t normally distributed.

7

Page 8: Some Assorted Formulae s - utstat.utoronto.cautstat.utoronto.ca/hadas/STA248/Test/mtsol2006.pdfSome test statistics: zobs = x 0 ˙= p n tobs = x 0 s= p n 1. 1. ... Explain. Method

7. Suppose we have n data values from a Normal distribution with µ unknown but σ is known.We want to test H0 : µ = µ0 versus Ha : µ 6= µ0

(a) (4 marks) Show that the power of the test when µ = µ′ is

1− Φ

(

zα/2 +µ0 − µ′

σ/√

n

)

+ Φ

(

−zα/2 +µ0 − µ′

σ/√

n

)

where Φ is the standard Normal cumulative distribution function.Reject H0 if

x− µ0

σ/√

n≥ zα/2 or

x− µ0

σ/√

n≤ −zα/2

i.e.x ≥ µ0 + zα/2σ/

√n or x ≤ µ0 − zα/2σ/

√n

Power(µ′) = P (reject H0 when µ = µ′)

= P

(

X − µ′

σ/√

n≥ µ0 − µ′

σ/√

n+ zα/2

)

+ P

(

X − µ′

σ/√

n≤ µ0 − µ′

σ/√

n− zα/2

)

= 1− Φ

(

zα/2 +µ0 − µ′

σ/√

n

)

+ Φ

(

−zα/2 +µ0 − µ′

σ/√

n

)

(b) (2 marks) Give two ways the power could be increased.Any 2 of:- increase n- decrease σ- calculate the power at a value of µ′ further from µ0

8