[R-sig-Geo] question about simulating patchy landscapes [solved]
Dylan Beaudette
dylan.beaudette at gmail.com
Fri Oct 3 19:49:57 CEST 2008
On Friday 03 October 2008, Dylan Beaudette wrote:
> On Thursday 25 September 2008, Edzer Pebesma wrote:
> > demo(uisim)
>
> This seems work work with the demo code, but not with another example using
> my own data:
>
> # setup
> library(gstat)
> library(spgrass6)
>
> # load GRASS region settings
> G <- gmeta6()
> grd <- gmeta2grd()
>
> # make a new grid from GRASS region
> new_data <- SpatialGrid(grd)
>
>
> # works fine:
> var.model <- vgm(psill=10, model="Exp", range=1000)
> sim <- predict(gstat(formula=z~1, dummy=TRUE, beta=0, model=var.model,
> nmax=20), newdata = new_data, nsim = 1)
>
> # does not work -- produces a field of '0' values
> sim <- predict(gstat(formula=z~1, dummy=TRUE, beta=0, model=var.model,
> nmax=20), newdata = new_data, nsim = 1, indicators=TRUE)
>
Oops. It looks like my second example works when I set 'beta=0.5'. Probably my
lack of experience in this field that caused me to overlook the importance of
this parameter. Anyone care to explain why?
Cheers,
Dylan
> # any ideas on why UISIM works in the demo, and not in my examples? I have
> noticed that the syntax is slightly different in the demo, could this be
> the cause:
>
> # prediction grid:
> data(meuse.grid)
> gridded(meuse.grid) = ~x+y
>
> # define variable as dummy data
> v = vgm(.25, "Sph", 900)
> g = gstat(NULL, "var1", x~1, beta = .5, nmax = 20, model = v, dummy = TRUE)
>
> # simulation of a single variable
> out = predict(g, meuse.grid, nsim = 20, indicators = TRUE)
>
> Thanks,
> Dylan
--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341
More information about the R-sig-Geo
mailing list