## define number of cores for parallel computations
if(interactive()) ncpu <- 2L else ncpu <- 1L
data(meuse)
r.logzn.ml <- georob(log(zinc)~sqrt(dist), data=meuse, locations=~x+y,
variogram.model="RMexp", param=c(variance=0.15, nugget=0.05, scale=200),
tuning.psi=1000, control=control.georob(ml.method="ML"))
if(interactive()){
## example is run only in interactive session because cpu times exceeds 5 s
r.prflik <- profilelogLik(r.logzn.ml, values=expand.grid(scale=seq(75, 600, by=25)),
ncores = ncpu)
plot(loglik~scale, r.prflik, type="l")
abline(v=r.logzn.ml$variogram.object[[1]]$param["scale"], lty="dotted")
abline(h=r.logzn.ml$loglik-0.5*qchisq(0.95, 1), lty="dotted")
}
Run the code above in your browser using DataLab