[R] Survey - twophase
Mark Hempelmann
e.rehak at t-online.de
Mon Jun 5 18:12:18 CEST 2006
Dear WizaRds,
I am struggling with the use of twophase in package survey. My goal
is to compute a simple example in two phase sampling:
phase 1: I sample n1=1000 circuit boards and find 80 non functional
phase 2: Given the n1=1000 sample I sample n2=100 and find 15 non
functional. Let's say, phase 2 shows this result together with phase 1:
...................phase1........
...................ok defunct....
phase2 ok..........85....0.....85
.......defunct......5...10.....15
sum................90...10....100
That is in R:
fail <- data.frame(id=1:1000 , x=c(rep(0,920), rep(1,80)),
y=c(rep(0,985), rep(1,15)), n1=rep(1000,1000), n2=rep(100,1000),
N=rep(5000,1000))
des.fail <- twophase(id=list(~id,~id), data=fail, subset=~I(x==1))
# fpc=list(~n1,~n2)
svymean(~y, des.fail)
gives mean y 0.1875, SE 0.0196, but theoretically,
we have x.bar1 (phase1)=0.08 and y.bar2 (phase2)=0.15 defect boards.
Two phase sampling assumes some relation between the easily/ fast
received x-information and the elaborate/ time-consuming y-information,
say a ratio r=sum y (phase2)/ sum x (phase2)=15/10=1.5 (out of the above
table)
Ergo, the y.ratio estimator = r*x.bar(phase1) = 1.5*0.08 = 0.12 with
variance = (n1-n2)/n1 * s_regression^2/n2 + s_y^2/n1 = 900/1000 *
0.0765/100 + 0.129/1000 = .00081 SE .02846
with s_regression^2 =
yk=c(rep(0,85), rep(1,15)); xk=c(rep(0,90), rep(1,10))
1/98*sum((yk-1.5*xk)^2)
and
s_yk^2 =
1/99 * sum( (yk-.15)^2)=0.1287879
I am sorry to bother you with my false calculations, but I just don't
know how to receive the correct results. Please help. My example is
taken from Kauermann/ Kuechenhoff 2006, p. 111f.
thank you so much
yours always
mark
More information about the R-help
mailing list