Robert_V._Hogg,_Joseph_W._McKean,_Allen_T._Craig

(Jacob Rumans) #1
246 Some Elementary Statistical Inferences

getcis <- function(mat,cc=.90){
numb <- length(mat[,1]); ci <- c()
for(j in 1:numb)
{ci<-rbind(ci,t.test(mat[j,],conf.level=cc)$conf.int)}
return(ci)}
This function is also at the site discussed in Section 1.1.

(b)Run the following code which plots the intervals. Label the successful inter-
vals. Comment on the variability of the lengths of the confidence intervals.
cis<-getcis(mat); x<-1:m
plot(c(cis[,1],cis[,2])~c(x,x),pch="",xlab="Sample",ylab="CI")
points(cis[,1]~x,pch="L");points(cis[,2]~x,pch="U"); abline(h=0)

4.2.12.In Exercise 4.2.11, the sampling was from theN(0,1) distribution. Show,
however, that settingμ=0andσ= 1 is without loss of generality.
Hint:First,X 1 ,...,Xn is a random sample from the N(μ, σ^2 ) if and only if
Z 1 ,...,Znis a random sample from theN(0,1), whereZi=(Xi−μ)/σ.Then
show the confidence interval based on theZi’s contains 0 if and only if the confi-
dence interval based on theXi’s containsμ.


4.2.13.Change the code in the R functiongetcisso that it also returns the vector,
ind,whereind[i] = 1if theith confidence interval is successful and 0 otherwise.
Show that the empirical confidence level ismean(ind).
(a)Run 10,000 simulations for the normal setup in Exercise 4.2.11 and compute
the empirical confidence level.


(b)Run 10,000 simulations when the sampling is from the Cauchy distribution,
(1.8.8), and compute the empirical confidence level. Does it differ from (a)?
Note that the R codercauchy(k)returns a sample of sizekfrom this Cauchy
distribution.
(c)Note that these empirical confidence levels are proportions from samples that
are independent. Hence, use the 95% confidence interval given in expression
(4.2.14) to statistically investigate whether or not the true confidence levels
differ. Comment.
4.2.14.LetXdenote the mean of a random sample of size 25 from a gamma-type
distribution withα=4andβ>0. Use the Central Limit Theorem to find an
approximate 0.954 confidence interval forμ, the mean of the gamma distribution.
Hint: Use the random variable (X− 4 β)/(4β^2 /25)^1 /^2 =5X/ 2 β−10.
4.2.15.Letxbe the observed mean of a random sample of sizenfrom a distribution
having meanμand known varianceσ^2 .Findnso thatx−σ/4tox+σ/4isan
approximate 95% confidence interval forμ.


4.2.16.Assume a binomial model for a certain random variable. If we desire a 90%
confidence interval forpthat is at most 0.02 in length, findn.


Hint: Note that



(y/n)(1−y/n)≤


(^12 )(1−^12 ).
Free download pdf