Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Jackknife Estimation and Simulation Study for Gamma Distribution Quantiles - Prof. Mary Ka, Exams of Statistics

An r function (my.jack) to calculate jackknife estimates of bias and standard error for the .75 quantile estimator of a population distribution. It also includes a simulation study (sim.jack) to test the unbiasedness of the jackknife estimate for a gamma(15, 0.5) distribution with a sample size of 20. The results show that the jackknife estimate is actually biased, as it overestimates the true quantile.

Typology: Exams

Pre 2010

Uploaded on 09/17/2009

koofers-user-lx1
koofers-user-lx1 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Name: _Solutions ________________________________
22S:166 Computing in Statistics
Instructor: Cowles
Midterm 2, 2005
Instructions: You may use Windows R, or if you prefer, you may log into a Linux
computer and run Linux R. Copy and paste your solutions into this Word document.
Email the document as an attachment in a message to me at
kate-cowles@stat.uiowa.edu.
1. The .75 quantile of a vector of sample values may be used to estimate the
population .75 quantile of the variable of interest.
a. Write an R function to get jackknife estimates of bias and standard error of this
estimator.
Copy your R code here.
> My.Jack
function(x)
{
n <- length(x)
theta.hatn <- fivenum(x)[4]
theta.hat <- rep(0,n)
theta.wig <- rep(0,n)
for(ii in 1:n)
{
theta.hat[ii] <- fivenum(x[-ii])[4]
theta.wig[ii] <- n * theta.hatn - (n-1) * theta.hat[ii]
}
thetahat.dot <- mean(theta.hat)
thetawig.dot <- mean(theta.wig)
se.thetan <- sqrt(sum((theta.wig - thetawig.dot)^2) / (n * (n-1)))
bias = (n-1) * (thetahat.dot - theta.hatn)
unbiased <- n * theta.hatn - (n-1) * thetahat.dot
list(Theta.hatn = theta.hatn, Theta.hat = theta.hat, Theta.wig = theta.wig,
Std.Error = se.thetan, Bias = bias, Theta.Jack = thetawig.dot)
}
b. Generate a vector of 20 random values from a Gamma distribution with
parameters 15 and 0.5. Use this vector as input to your function in part a.
Copy the R output here.
> My.Jack(rgamma(20,15,0.5))
$Theta.hatn
[1] 37.08957
$Theta.hat
pf3

Partial preview of the text

Download Jackknife Estimation and Simulation Study for Gamma Distribution Quantiles - Prof. Mary Ka and more Exams Statistics in PDF only on Docsity!

Name: _Solutions ________________________________

22S:166 Computing in Statistics

Instructor: Cowles

Midterm 2, 2005

Instructions: You may use Windows R, or if you prefer, you may log into a Linux

computer and run Linux R. Copy and paste your solutions into this Word document.

Email the document as an attachment in a message to me at

kate-cowles@stat.uiowa.edu.

1. The .75 quantile of a vector of sample values may be used to estimate the

population .75 quantile of the variable of interest.

a. Write an R function to get jackknife estimates of bias and standard error of this

estimator.

Copy your R code here.

My.Jack function(x) { n <- length(x) theta.hatn <- fivenum(x)[4] theta.hat <- rep(0,n) theta.wig <- rep(0,n) for(ii in 1:n) { theta.hat[ii] <- fivenum(x[-ii])[4] theta.wig[ii] <- n * theta.hatn - (n-1) * theta.hat[ii] } thetahat.dot <- mean(theta.hat) thetawig.dot <- mean(theta.wig) se.thetan <- sqrt(sum((theta.wig - thetawig.dot)^2) / (n * (n-1))) bias = (n-1) * (thetahat.dot - theta.hatn) unbiased <- n * theta.hatn - (n-1) * thetahat.dot list(Theta.hatn = theta.hatn, Theta.hat = theta.hat, Theta.wig = theta.wig, Std.Error = se.thetan, Bias = bias, Theta.Jack = thetawig.dot) }

b. Generate a vector of 20 random values from a Gamma distribution with

parameters 15 and 0.5. Use this vector as input to your function in part a.

Copy the R output here.

My.Jack(rgamma(20,15,0.5)) $Theta.hatn [1] 37. $Theta.hat

[1] 37.08957 37.08957 37.08957 37.08957 36.16233 37.08957 37.08957 36.

[9] 37.08957 37.08957 36.16233 36.56118 37.08957 36.16233 37.08957 37.

[17] 37.08957 37.08957 37.08957 36.

$Theta.wig [1] 37.08957 37.08957 37.08957 37.08957 54.70705 37.08957 37.08957 54. [9] 37.08957 37.08957 54.70705 47.12894 37.08957 54.70705 37.08957 37. [17] 37.08957 37.08957 37.08957 54. $Std.Error [1] 1. $Bias [1] -4. $Theta.Jack [1] 41.

2. Is the jackknife “unbiased” estimate of the 0.75 quantile of a population

distribution really unbiased? Carry out a simulation study to find out for the case

when the sample size is 20 and the population distribution is Gamma(15, 0.5).

Note: when testing and debugging your code, use a very small number of

replicate datasets to save time. Using the jackknife within a simulation study is

time consuming, so you may do your final run with only 1000 replicate datasets.

Copy your R code here.

Sim.Jack function(B = 10) { jack.75 = rep(0,B) for(k in 1:B) { jack.75[k] = My.Jack(rgamma(20,15,0.5))$Theta.Jack } list(Real.Value = qgamma(0.75,15,0.5), Jack.Unbiased = mean(jack.75)) }

Copy your R output here.

Sim.Jack(1000) $Real.Value [1] 34. $Jack.Unbiased [1] 41.

Write a sentence or two interpreting your results here.

The jackknife “unbiased” estimate of the 0.75 quantile of the population distribution,

Gamma(15, 0.5), with the value 41.3, is larger than the real quantile which is 34.8. Therefore,

it is actually BIASED.

3. The EM algorithm. A student wishes to estimate the probability p of obtaining a

head on the flip of a coin. He intends to flip the coin 10 times. However, after

the 8th^ flip, he accidentally drops the coin down a storm sewer and the experiment