Вы находитесь на странице: 1из 3

HOMEWORK I

Anh Nguyen
Stat 5421
Student ID: 4743426

Question 1.2:
a) Let X = number of correct answers, X ~ Bin(100,)
= probbability of a correct answer in four possible answers =
= 0.25
b) Mean: = E(X) = n = 100 *0.25 = 25
Variance: 2 = Var(X) = n(1-)= 100*0.25 *0.75 = 18.75
Yes, it would be surprising if a student made at least 50 correct
response since by using R, we get P(X 50 =0 .
c) Let nj= number of times the student picked choice j
Then (n1, n2 , n3, n4)~ Multinomial(n=100, 1, 2, 3, 4 )
1 = 2 = 3 = 4 = 0.25
d) E(nj) = nj
E(n1) = E(n2) = E(n3) = E(n4)= 100*0.25 = 25
Var(nj) = nj (1- j )
Var(n1) = Var(n2) =Var(n3) =Var(n4) =100*0.25*0.75 =
18.75
Cov(nj,nk) = -n*jk =-100*0.25*0.25= -6.25
Corr(nj,nk) = Cov (nj,nk)/ Var (n j)Var (nk ) = -6.25/ (18.7518.75)
=-0.333
Question 1.9:
X = number of green seedlings = 854
n = total number of green seedlings = 1103
= probability of green seedling
Hypothesis testing: Ho: = 0.75
H1 : 0.75
a) Wald statistic test: ^ = x/n = 854/1103 = 0.77425204
^ 0
z=
= (0.77425204 0.75)/
^ (1 ^ )/n
0.77425204(10.77425204)/1103
= 1.9266
Using R: > pval = 2*(1-pnorm(q=1.9266))
> pval
[1] 0.0540295
Hence, p-value = 0.0540295 > 0.05 , there is evidence to
support Ho, which means the ratio of green seedlings to yello
seedlings = 3:1 is true.
b) Likelikhood ratio test statistic:
Using R:
> mu.hat= 0.77425204

> mu.zero= 0.75


> x=854
> n=1103
> g.sq=2*(x*log(mu.hat/mu.zero)+(n-x)*log((1-mu.hat)/(1mu.zero)))
> g.sq
[1] 3.539017
> pval=1-pchisq(q=g.sq,df=1)
> pval
[1] 0.05994099
P-value = 0.05994099 > 0.05. Hence, there is strong evidence to
support Ho
c) Score test:
Using R:
> mu.hat=0.77425204
> mu.zero = 0.75
> x=854
> n=1103
> zscore = (mu.hat-mu.zero)/sqrt(mu.zero*(1-mu.zero)/n)
> zscore
[1] 1.860096
> pval=2*(1-pnorm(q=zscore))
> pval
[1] 0.06287192
P-value = 0.06287192 > 0.05. Hence, accept H0
Question 1.10:
Let Y = number of deaths of soldiers from army mules. Y takes
on values in the set {0,1,2,3,4} with unknown probabilities
1,2,3,4,5 respectivly .
Define Nj as number of corps-years, then (N1, ..., N5) ~
Multinom(n=200, 1,...,5) and the observed counts (n1,...,n5) =
(109,65,22,3,1)
Hypothesis testing:
j1
/ ( j1 ) !
4
H0:
, j=1,...,5
k /k !
k=0

j
j

H1: 1,...,5 are free non-negative parameters such that


= 1 and H0 is false.
k

Then, L(;n1,...,n5) = C2 + log()

n j ( j1)
j=1

Using R:

- log(

/k !
5

nj
k=0

j=1

> minusL= function(mu,n.list){}


> minusL= function(mu,n.list){
+ val = log(mu)*sum(n.list*(0:4)) log(sum(mu^(0:4)/factorial(0:4)))*sum(n.list)
+ return(-val)}
> n.list = c(109,65,22,3,1)
> mu.hat=optimize(f=minusL,interval=c(1e10,1e10),n.list=n.list)$min
> mu.hat
[1] 0.6119384
> probs = mu.hat^(0:4)/
(factorial(0:4)*sum(mu.hat^(0:4)/factorial(0:4)))
> probs
[1] 0.542532519 0.331996496 0.101580707 0.020720379
0.003169899
> expected.counts=200*probs
> expected.counts
[1] 108.5065038 66.3992992 20.3161413 4.1440758
0.6339798
> g.sq = 2*sum(n.list*log(n.list/expected.counts))
> g.sq
[1] 0.6969812
> p1 = 1- pchisq(q=g.sq,df=3)
> p1
[1] 0.8739138
> x.sq = sum((n.list-expected.counts)^2/expected.counts)
> x.sq
[1] 0.6984641
> p2 = 1-pchisq(q=x.sq,df=3)
> p2
[1] 0.8735652
Likelihood ratio test statistic: g2 = 0.6969812 ,p-value =
0.8739138 > 0.05. Hence, accept H0
Pearsons Chi-squared test-statistic: x2 = 0.6984641,
p-value = 0.8735652 >0.05. Hence, accept H0

Вам также может понравиться