
Dear R-users,

I use the following function to simulate CSR 
point
pattern “nsim” times.

I need huge number of simulation, 
let say, nsim=20000, which
yields very long running time (in hours 
scale!!). Is there a way to reduce running time (maybe
by avoiding 
the loop)?

Many thanks in advance.

Hamid

bakhti<-function(nsim)

{

n<-c(10,20,25,30,40,50,100,200,300)

#n
 is the number of points in unit square

#nsim is the number of 
simulation

for ( j in 1:length(n))

{

 Xsim<-
vector("list",nsim)

 for
  (i in 1: nsim)

{

     Xsim[[i]] <-
rpoispp3(n[j])

}

  ksim
 <-
sapply(Xsim, function(x) K3est(x, rmax=1,nrval=101)$iso)

 }

 return(ksim)

}



      
	[[alternative HTML version deleted]]

