31.01.2015 Views

MATH1725 Introduction to Statistics: Worked examples

MATH1725 Introduction to Statistics: Worked examples

MATH1725 Introduction to Statistics: Worked examples

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Answer: 15<br />

Question (lecture 8).<br />

For values (x,y) as given below, obtain the sample correlation r.<br />

Answer: 16<br />

x i 1.1 2.2 3.4 4.5 5.0<br />

y i 3.3 6.1 7.0 10.4 11.5<br />

Question (lecture 10).<br />

For values (x,y) as given below, obtain the line of regression for y given x. What does the residual<br />

at the first data point x 1 = 1.1 equal If x = 4, what is the predicted value of y<br />

Answer: 17<br />

x i 1.1 2.2 3.4 4.5 5.0<br />

y i 3.3 6.1 7.0 10.4 11.5<br />

Question (lecture 10).<br />

For values (x,y) as given below, a line of regression for y given x is fitted.<br />

Test the hypothesis that the slope β equals zero.<br />

Answer: 18<br />

x i 1.1 2.2 3.4 4.5 5.0<br />

y i 3.3 6.1 7.0 10.4 11.5<br />

Question (lecture 11).<br />

Suppose pr{X = x} = x 10<br />

for x = 1,2,3,4. Check that the probability function is valid (is 0 ≤<br />

pr{X = x} ≤ 1 for all x and does ∑ pr{X = x} = 1). Calculate E[X] and Var[X].<br />

x<br />

15 n = 4, ¯x = 4, s 2 = 3.333, µ 0 = 1, s 2 ¯x − µ0<br />

/n = 0.8333. Test statistic is t =<br />

σ/ √ n = √ 4 − 1 = 3.286. Test rule is<br />

0.8333<br />

reject H 0 if |t| > t 3(2.5%). As t 3(2.5%) = 3.182, reject H 0 at 5% level.<br />

16 ¯x = 3.24, s 2 x = 1 X<br />

(xi − ¯x) 2 = 1 “X<br />

x<br />

2<br />

i − n¯x 2” = 2.593,<br />

n − 1<br />

n − 1<br />

ȳ = 7.66, s 2 y = 1 X<br />

(yi − ȳ) 2 = 1 “X<br />

y<br />

2<br />

i − nȳ 2” = 11.033,<br />

n − 1<br />

n − 1<br />

s xy = 1 X<br />

(xi − ¯x)(y i − ȳ) = 1 “X<br />

xiy i − n¯xȳ”<br />

= 5.2645, r XY = s p xy/ s<br />

n − 1<br />

n − 1<br />

2 xs 2 y = 0.984.<br />

Check your answer using R!<br />

x=c(1.1,2.2,3.4,4.5,5.0) # And setup y similarly.<br />

cor(x,y)<br />

17 ¯x = 3.24, ȳ = 7.66, s 2 x = 2.593, s 2 y = 11.033, s xy = 5.2645. Regression line is y = α + βx where ˆβ = s xy/s 2 x =<br />

2.030, ˆα = ȳ − ˆβ¯x = 1.082 so fitted line is y = 1.082 + 2.030x. If x 1 = 1.1, predict ŷ 1 = 3.315. At x = 1.1, residual<br />

is r 1 = y 1 − ŷ 1 = 3.3 − 3.315 = −0.015. If x = 4, predict y = 9.023. Check your answers using R!<br />

x=c(1.1,2.2,3.4,4.5,5.0) # And setup y similarly.<br />

lm(y∼x) # Gives parameter estimates.<br />

model=lm(y∼x) # S<strong>to</strong>res regression model output as model.<br />

model$residual[1]<br />

r<br />

# First residual value.<br />

18 If H 0: β = 0, then ˆβ/ ˆσ<br />

2<br />

∼ t n−2, where S xx = P r<br />

ˆσ<br />

(x i − ¯x) 2 = (n − 1)s 2 2<br />

x. Here = 0.2105 where<br />

S xx S xx<br />

S xx = (n − 1)s 2 x = 10.372. Thus t = 9.646. t 3(2.5%) = 3.182. As |t| > 3.182, reject H 0 at 5% level. Check<br />

your answers using R!<br />

x=c(1.1,2.2,3.4,4.5,5.0) # And setup y similarly.<br />

model=lm(y∼x)<br />

summary(model) # Can you find your answers in the R output<br />

13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!