[R-sig-Geo] ossfim with Universal Kriging?

Alí Santacruz amsantac at hotmail.com
Sun Jul 9 19:50:46 CEST 2006


Dear Edzer,

Replacing e+n with x+y does not work either:

>err.grid <- ossfim.UK(seq(10,60,10),block.sizes=0,m.f.exp.t1)
Error in model.frame(formula, rownames, variables, varnames, extras, 
extranames,  :
        variable lengths differ (found for 'y')
In addition: Warning message:
'newdata' had 1 rows but variable(s) found have 104 rows


Alí




>From: Edzer J Pebesma <e.pebesma at geo.uu.nl>
>To: Alí Santacruz <amsantac at hotmail.com>
>CC: r-sig-geo at stat.math.ethz.ch
>Subject: Re: [R-sig-Geo] ossfim with Universal Kriging?
>Date: Sat, 08 Jul 2006 21:48:21 +0200
>
>Ali, if you replace e+n with x+y, does that work?
>
>I wasn't aware that ossfim was this restrictive; there's
>clearly some room for generalisation here.
>--
>Edzer
>
>Alí Santacruz wrote:
>
>>Dear list members:
>>
>>I am trying to make a cost/benefit analysis in a sampling network for 
>>organic matter soil content data. The best model fitted was exponential 
>>(universal kriging, first order trend).
>>
>>So I need to know if it is possible to use ossfim function with universal 
>>kriging.
>>
>>I tried to modify the ossfim function but I get an error:
>>
>>
>>
>>>ossfim.UK<-function (spacings = 1:5, block.sizes = 1:5, model, nmax = 25,
>>>
>>>
>>+     debug = 0)
>>+ {
>>+     n = floor(sqrt(nmax)) + 1
>>+     x = 0:(n - 1) + 0.5
>>+     x = sort(c(-x, x))
>>+     ret = matrix(NA, length(spacings) * length(block.sizes),
>>+         3)
>>+     r = 1
>>+     for (sp in spacings) {
>>+         for (bl in block.sizes) {
>>+             data.grid = data.frame(expand.grid(x * sp, x * sp),
>>+                 z = rep(1, length(x)^2))
>>+             names(data.grid) = c("x", "y", "z")
>>+             gridded(data.grid) = c("x", "y")
>>+             x0 = SpatialPoints(matrix(0, 1, 2))
>>## Next I modify the formula in krige using the coordinates names of my 
>>data
>>## to use universal kriging:
>>+             kr = krige(z ~ e+n, data.grid, x0, block = c(bl, bl),
>>+                 model = model, nmax = nmax, set = list(debug = debug))
>>+             ret[r, ] = c(sp, bl, sqrt(kr[["var1.var"]][1]))
>>+             r = r + 1
>>+         }
>>+     }
>>+     ret = data.frame(ret)
>>+     names(ret) = c("spacing", "block.size", "kriging.se")
>>+     ret
>>+ }
>>
>>
>>>err.grid <- ossfim.UK(seq(10,60,10),block.sizes=0,m.f.exp.t1)
>>>
>>>
>>Error in model.frame(formula, rownames, variables, varnames, extras, 
>>extranames,  :
>>        variable lengths differ (found for 'e')
>>
>>Is it possible what I want to do? Does it have sense?
>>
>>I appreciate any help or comment.
>>
>>Sincerely,
>>
>>Alí M. Santacruz
>>M.Sc. Geomatics, Student
>>National University of Colombia
>>Bogotá D.C.
>>
>>_______________________________________________
>>R-sig-Geo mailing list
>>R-sig-Geo at stat.math.ethz.ch
>>https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>




More information about the R-sig-Geo mailing list