Agriculture Reference
In-Depth Information
Fig. 6.1 n ¼100 units selected from N ¼1,000 with a simple random sampling without replace-
ment scheme
12345
200 200 200 200 200
> framepop < - cbind(framepop,yobs,q1obs,q2obs)
The most widely used R package for pseudo-randomly 1 selecting a sample is
sampling . It is a collection of sampling algorithms that were described in Till´
( 2006 ). The SRS function is srswor , and is used in this example to select n
100
units without replacement (see Fig. 6.1 ). The outcome of this function is a vector of
size N, which is an indicator variable equal to 1 if the unit is selected, and 0 otherwise:
¼
> 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))
> box()
> set.seed(200694)
> srs < - srswor(n,N)
> table(srs)
srs
01
900 100
> framesrs < - framepop[srs ¼¼ 1,]
> points(framesrs$xc,framesrs$yc, pch ¼ 1, cex ¼ 2)
Search WWH ::




Custom Search