[R] uniform and clumped point plots

Sean O'Riordain seanpor at acm.org
Thu May 18 16:02:43 CEST 2006


Perhaps you're looking for something along the lines of Sobol
sequences - refer Section 7.7 of Numerical Recipes in C by Press et
al.

Sean

On 18/05/06, Ben Bolker <bolker at ufl.edu> wrote:
> Beutel, Terry S <Terry.Beutel <at> dpi.qld.gov.au> writes:
>
> >
> > I am trying to generate two dimensional random coordinates.
> >
> > For randomly distributed data I have simply used
> >
> > >xy<-cbind(runif(100),runif(100))
> >
> > However I also want to generate coordinates that are more uniformly
> > distributed, and coordinates that are more contagiously distributed than
> > the above.
> >
> >
>
> here are some pictures I made for a talk recently, using
> the Poisson cluster process function from "splancs" and
> the Strauss process from "spatial" (I think)
>
> library(splancs)
> library(spatial)
> set.seed(1001)
> sq <- as.matrix(data.frame(x=c(0,1,1,0,0),y=c(0,0,1,1,0)))
> p.cl <- pcp.sim(rho=10,m=10,s2=0.001,region.poly=sq)
> plot(p.cl)
> n <- nrow(p.cl)
> p.ran <- matrix(runif(2*n),nrow=n,dimnames=list(NULL,c("x","y")))
> ppregion()
> p.reg <- Strauss(n,c=0.1,r=0.1)
> p.reg <- matrix(c(p.reg$x,p.reg$y),nrow=n,dimnames=list(NULL,c("x","y")))
> all <- data.frame(rbind(p.cl,p.ran,p.reg),
>                   tr=rep(c("clustered","random","regular"),each=n))
> library(lattice)
> lattice.options(default.theme = ltheme) ## set as default
> ltheme <- col.whitebg()
> ltheme$xyplot.background$col <- "transparent" ## change strip bg
>
> trellis.par.set(theme=col.whitebg())
> print(xyplot(y~x|tr,data=all,layout=c(3,1),aspect="iso",scales=list(draw=FALSE),
>              bg="transparent",pch=16))
>
>   Ben Bolker
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list