DOC PREVIEW
UW-Madison STAT 411 - Using+R+in+ratio+est

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Nordheim Statistics 411 Spring 2015 (Feb 24) Using R for Ratio Estimation Given below is a relatively simple way to use R to perform the calculations for ratio estimation. (This will be particularly useful with larger data sets.) Although there exist “full-service” packages within R to perform various types of calculations with survey sampling, at this stage it is important, in my view, to understand the specific nature of the calculations. Thus, I strongly encourage you to use a process such as this. (We will examine one of the “full-service” packages later.) Note --- this is the example discussed in class. > physpopdf pop phys 1 40 140 2 300 960 3 120 400 4 80 260 5 20 60 It is always a good idea to make a plot first. > xlim=range(0,pop) This is a procedure to create a scatterplot that includes > ylim=range(0,phys) the origin. This is important for ratio estimation. > plot(pop,phys,plot.window(xlim,ylim)) > N=50 > n=5 > popbar=mean(pop) [1] 112 > physbar=mean(phys) [1] 364 > Rhat=physbar/popbar This gives us the ratio estimator. > Rhat [1] 3.25 > resid=phys-Rhat*pop > resid [1] 10 -15 10 0 -5 > srsq=sum(resid**2)/(n-1) This is what we call € sr2 . > srsq [1] 112.5 > eVRhat=(1-n/N)*(1/popbar**2)*(srsq/n) This is the estimated variance of the ratio estimator. Note: If we have the true mean population, we could use that in this expression instead of “popbar”. > eVRhat [1] 0.001614318 > serrRhat=sqrt(eVRhat) This is the standard error of the ratio estimator. > serrRhat [1] 0.04017857 0 50 100 150 200 250 3000 200 400 600 800popphysSuppose know we wish to estimate the total number of physicians in the state. Suppose that we know the true population in the state; suppose this is τX= 5600. (Note, that for the sake of this example, I have chosen the true county population mean to equal the sample mean. In practice, this will generally not be the case.) Then, ˆτyr=ˆRτx= 3.25* 5600 =18, 200and Var(ˆτyr) =τx2Var(ˆR) = 56002* 0.001614 = 50615.04 = (224.98)2 . --- Suppose now that we did NOT have any information on county population and wished to estimate the total number of physicians in the state. Thus, this is now just an SRS with a sample of size 5 values (number of doctors in a county) from the population of 50 values. Now, y = 364 . Then, ˆτy= Ny = 50 * 364 =18, 200 . (This is the same as the ratio estimator only because I chose the true county population mean to be the same as the sample mean.) Now, Var(ˆτy) = N2(1−nN)sy2 . Using R, > var(phys) [1] 127480 Then, Var(ˆτy) = 502*(1− 5 / 50)*127480 = (17400)2 . Note how much larger Var(ˆτy) is than


View Full Document

UW-Madison STAT 411 - Using+R+in+ratio+est

Download Using+R+in+ratio+est
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Using+R+in+ratio+est and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Using+R+in+ratio+est 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?