STAT 511 Solution to HW5 Spring 2008

advertisement
STAT 511
Solution to HW5
Spring 2008
0.4
Exponential Decay
Michaelis−Menten
Exponential Decay
Michaelis−Menten
0.0
0.0
−0.4
0.5
−0.2
1.0
y
residual
1.5
0.2
2.0
2.5
1. (a) The estimates of (θ1 , θ2 ) in exponential decay model is (2.6566, 0.1744) and the
estimates of (θ1 , θ2 ) in Michaelis-Menten model is (4.021, 8.205). The fitted
mean curves are shown in the following plot. These two curves are almost the
2
4
6
8
10
2
t
4
6
8
10
t
same and we can not tell which one looks better than the other. However, from
the sum of the squares of the these two models, exponential model seems to
have smaller “deviance”. The residual plots for both model are given in above
plot. The Normal Q-Q plots are shown in the following page. There seems to
be a linear trend except for that one point at the left lower corner departs far
away from the straight line. Since the sample is too small, we can not conclude
that they have obvious “normal” problem.
(ti ,θ)
|θ̂j ). Thus we can use the following R codes to verify
(b) We know that D̂ = ( ∂f∂θ
j
the nls output
Dhat<-cbind(1-exp(-0.1744*t),t*2.6566*exp(-0.1744*t))
covtheta<-(0.1806/6)*solve(t(Dhat)%*%Dhat)
sqrt(covtheta[1,1])
sqrt(covtheta[2,2])
We find these results are the same with the nls outputs. Then we can get a
95% confidence interval for the mean BOD at 6 days as (1.54226, 1.904945).
And the 95% confidence interval for the observed BOD at 6 days as (1.261969,
2.185236). The R codes are
Ghat<-c(1-exp(-0.1744*6),6*2.6566*exp(-0.1744*6))
GDDG<-t(Ghat)%*%(solve(t(Dhat)%*%Dhat))%*%Ghat
bod6<-2.6566*(1-exp(-0.1744*6))
bod6lo<-2.6566*(1-exp(-0.1744*6))-qt(0.975,6)*sqrt((0.1806/6)*(GDDG))
bod6up<-2.6566*(1-exp(-0.1744*6))+qt(0.975,6)*sqrt((0.1806/6)*(GDDG))
1
Q−Q Plot for Michalis−Menten
0.0
−0.1
−0.3
−0.2
Sample Quantiles
−0.1
−0.2
−0.4
−0.3
−1.5
−1.0
−0.5
0.0
0.5
1.0
1.5
−1.5
−1.0
Theoretical Quantiles
−0.5
0.0
0.5
1.0
1.5
Theoretical Quantiles
obod6lo<-2.6566*(1-exp(-0.1744*6))-qt(0.975,6)*sqrt((0.1806/6)*(GDDG+1))
obod6up<-2.6566*(1-exp(-0.1744*6))+qt(0.975,6)*sqrt((0.1806/6)*(GDDG+1))
(c) We know the limiting value of mean BOD is θ1 . Then the point time where mean
BOD reaches 50% of its limiting value is t0.5 = log(2)/θ2 . This is a function
of θ2 . So a sensible estimate of t0.5 is log(2)/0.1744 = 3.974468. Applying the
delta method, we get the asymptotic variance as (log(2)/θ22 )2 V ar(θ̂2 ). Then an
estimated standard deviation is (log(2)/θ̂22 )Sd(θ̂2 ) = 1.010137.
0.4
(d) The contour plot based on the likelihood is shown in the the following picture.
Then an approximate 95% confidence interval for θ1 is (2.25, 3.75), and for θ2
is (0.10, 0.26).
0.2
0.3
95% joint CI
95% CI for individual
0.0
0.1
theta 2
Sample Quantiles
0.0
0.1
0.1
Q−Q Plot for Exponential Decay
1
2
3
4
5
theta 1
(e) The 95% t confidence interval for θ1 , θ2 are (1.790655, 3.522579) and (0.06593571,
0.28287892) respectively. The t interval for θ1 is shorter than the confidence
interval based on the likelihood. Two methods almost produce the same confidence intervals for θ2 . The t interval is symmetric but the interval based on
2
likelihood is not symmetric. Use confint() in stats, we get confidence interval for
θ1 as (2.08048731, 4.2513613) and for θ2 as (0.08120833, 0.2947727). We find
that the confidence intervals are the same as those obtained from the likelihood.
(f) Based on SSE/σ 2 ∼ χ2n−k , the confidence interval for σ is
q
q
( SSE/χ2n−k,1−α/2 , SSE/χ2n−k,α/2 ).
That is (0.1118088, 0.3820810). Based on the profile likelihood, the confidence
interval is
SSE
SSE
1
{σ 2 : log σ 2 +
− (log
+ 1) < χ21, 0.95 }
2
nσ
n
n
95% Simultaneous CI
Mean estimation
1.5
0.0
0.5
1.0
y
2.0
2.5
3.0
Then according to the numeric method, we can get the confidence interval for σ 2
as (0.00973, 0.07272). Then the confidence interval for σ is (0.09864, 0.26967).
(g) The simultaneous confidence interval is shown in following plot.
2
4
6
8
10
12
14
t
t<-c(1,2,3,4,5,7,9,11)
y<-c(.047,.74,1.17,1.42,1.60,1.84,2.19,2.17)
simuci<-function(tpois) { theta1<-seq(2,4.5,length=100)
theta2<-seq(0.08,0.3,length=100) theta<-expand.grid(theta1,theta2)
ss<-function(the)
{ sum((y-the[1]*(1-exp(-the[2]*t)))^2) }
SumofSquares<-apply(theta,1,ss)
loc<-which(SumofSquares<0.1806348*exp(qchisq(0.95,2)/8),arr.ind=T)
BOD<-function(the)
{ the[1]*(1-exp(-the[2]*tpois))}
inci<-theta[loc,] means<-apply(inci,1,BOD)
ci<-c(min(means),max(means)) return(ci) }
tt<-as.matrix(seq(1,15,length=20)) ci<-apply(tt,1,simuci)
plot(tt,ci[1,],type="l",ylim=c(0,3),xlab="t",ylab="y")
lines(tt,ci[2,],type="l")
lines(tt,2.6566*(1-exp(-0.1744*tt)),lty=2,col=4)
legend("topleft",c("95% Simultaneous CI","Mean estimation"),lty=c(1,2),col=c(1,4))
3
Download