Problem 5.6

ci= (65,77)

mean<-mean(c(65,77))
mean
## [1] 71
se<-(77-65)/((1.645)*2)
se
## [1] 3.647416
moe<-se*.90
moe
## [1] 3.282675
sd<-se*sqrt(25)
sd
## [1] 18.23708

Problem 5.14

moe<-25
sd<-250
z<-qnorm(.95)

n<-(sd*z/moe)^2
n
## [1] 270.5543
  1. It should be larger because we want the same margin of error error with more confidence. The number is proportional to the confidence level and inversely to the margin of error so since moe is constant, if ci increases so must the n.

moe<-25
sd<-250
z<-qnorm(.995)

n<-(sd*z/moe)^2
n
## [1] 663.4897

Problem 5.20

  1. There appears to be a difference between the reading and writing scores. Whether it is signfiicant or not remains to be seen, the difference has a slight rightward skew, but with error could be centered at zero.

  2. The reading and writing are paired, same student and are thus not independent.

Ho: read-write is not different from zero.

Ha: read-write is different from zero

  1. n = 200 > 30

    The histogram of differences appears to be relatively gaussian with little skew.

alpha = 0.05

x<-(-0.545)
u<-0
sd<-8.887
n<-200
se<-sd/sqrt(n)

t<-(x-u)/se
t
## [1] -0.867274
df<-n-1

pt(t,n-1)
## [1] 0.1934182

So this value is above our alpha which means we fail to reject the null hypothesis.

  1. We might have made a type II error in this case if we failed to reject a false null hypothesis.

  2. I would expect a confidence interval to contain zero because if we reject the null hypothesis we are confident at alpha = 0.95 level that repeated resamples’ confidence intervals would contain the true mean and zero. Confidence intervals spanning zero and the difference being equal to zero are logically equivalent concepts, if and only if.

Problem 5.32

t-test with equal sample size, equal variance:

x1<-16.12
x2<-19.85
sd1<-3.58
sd2<-4.51
n<-26

sp<-sqrt((sd1^2+sd2^2)/2)
t<-(x1-x2)/(sp*sqrt(2/n))

df<-2*n-2

pt(t,df)
## [1] 0.000885899

There is strong evidence that these means are different. Since p < 0.05, we conclude the difference is significantly different than zero.

Problem 5.48

H0: None of the means are different across groups.

Ha: At least one of these means are different across the groups

  1. The sample size is greater than 1000 so that condition is met. The groups have similar tandard deviations. The data are independent by the nature of the groups (you cannot belong to more than one). The data appear normal or centrally distributed in the box plots.

n<-1172
k<-5

df1<-k-1
df2<-n-k
df1
## [1] 4
df2
## [1] 1167
pf<-0.0682
f<-qf(1-pf,df1,df2)
f
## [1] 2.188931
MSG<-501.54
MSE<-MSG/f
MSE
## [1] 229.1255
SSG<-df1*MSG
SSE<-df2*MSE
SSG
## [1] 2006.16
SSE
## [1] 267389.5
dftot<-df1+df2
dftot
## [1] 1171
SSTot<-SSG+SSE
SSTot
## [1] 269395.6

The p value is bigger than 0.05 so we do not reject the null hypothesis.