[R-sig-Geo] GRTS sampling

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Wed Mar 27 12:13:56 CET 2013


Dear all,

I have put the code that I've posted before into a package. The package is available on R-forge.

install.packages("GRTS", repos="http://R-Forge.R-project.org")

Any comments are welcome.

Best regards,

Thierry

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx at inbo.be
www.inbo.be

To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey



On Mon, Feb 11, 2013 at 6:45 AM, Dick Brus <dick.brus at wur.nl> wrote:

> I try to understand the hierarchical randomization as applied in the
> GRTS design.
>
> I randomized 16 points on a square grid, see R script below. The
> argument do.sample was set to FALSE, so that the result consists of a
> dataframe of all 16 points instead of a GRTS sample. When plotting the
> order of the points it appears that the numbers 1-4 are not always in
> different subsquares (of which there are four) , for instance points 1
> and 3 are both in the lower-right subsquare. What am I doing wrong?
>
> library(spsurvey)
>
> frame<-expand.grid(x=seq(from=1,to=4,by=1),y=seq(from=1,to=4,by=1))
>
> #population size (total number of sampling units in Kandahar)
> N<-nrow(frame)
>
> #set number of sampling units (sample size) to be selected
> n<-4
>
> design<-list(None=list(panel=c(Panel1=n), seltype="Equal",
> caty.n=c("Caty 1"=n), over=0)) x<-frame$x y<-frame$y index<-1:N
> att<-data.frame(x=x,y=y,ids=index)
>
> #do.sample=FALSE gives all sampling units in hierarchical? randomized
> order res<-grts(design, DesignID="Site", SiteBegin=1, type.frame="finite",
>          src.frame="att.frame", in.shape=NULL, sp.object=NULL,
> att.frame=att,
>          id=NULL, xcoord="x", ycoord="y", stratum=NULL, mdcaty=NULL,
> startlev=2,
>          maxlev=11, maxtry=1000, shift.grid=FALSE,
> do.sample=rep(FALSE, length(design)),
>          shapefile=FALSE, prjfilename=NULL, out.shape="sample")
> frame.randomized<-data.frame(res$xcoord,res$ycoord)
> names(frame.randomized)<-c("x","y")
> frame.randomized$id<-1:N
>
> png(file = "GRTSRandomizedFrameSquare.png", width = 480, height = 480)
> print(
>   ggplot(data = frame.randomized) +
>     geom_text(
>       data = frame.randomized,
>       mapping = aes(
>         x = x,
>         y = y,
>         label = id
>       ),
>       size = 5
>     ) +
>     coord_equal()
> )
> dev.off()
>
> <
> http://r-sig-geo.2731867.n2.nabble.com/file/n7582569/GRTSRandomizedFra
> meSquare.png
> >
>
>
>
> --
> View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/GRTS-sampling-tp7582569.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document.
The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.



More information about the R-sig-Geo mailing list