Agriculture Reference
In-Depth Information
Fig. 6.4 Sample selected with a stratified design with four strata
11 12 21 22
258 256 248 238
>
set.seed(200694)
>
str
<
- strata(framepop,"strataid",size
¼
rep(25,4),method
¼
"srswor")
>
str
<
- getdata(framepop,str)
>
smpstr
<
- table(str$strataid)
>
smpstr
11 12 21 22
25 25 25 25
>
par(mar
¼
c(1,1,1,1), xaxs
¼
"i",yaxs
¼
"i")
>
plot(framepop$xc,framepop$yc, axes
¼
F,cex
¼
0.5,
+ pch
¼
19,xlim
¼
c(0,1),ylim
¼
c(0,1))
>
abline(h
¼
0.5,lty
¼
2,lwd
¼
2)
>
abline(v
¼
0.5,lty
¼
2,lwd
¼
2)
>
box()
>
points(str$xc,str$yc, pch
¼
1, cex
¼
2)
>
dstrsrs
<
- svydesign(id
¼
~1,strata
¼
~strataid,data
¼
str,fpc
¼
~Prob)
>
estrsrs
<
- svytotal(~yobs+as.factor(q1obs),dstrsrs,deff
¼
T)
Search WWH ::
Custom Search