Loading ...
Sorry, an error occurred while loading the content.

AI-GEOSTATS: more gstat in R doubts: UK with covariate did not work

Expand Messages
  • Marta Rufino
    ... #So for example, if I additionally do (just playing not seriously....): vgm2
    Message 1 of 2 , Dec 11 3:18 AM
      >Dear colegues,
      >When trying Edzer suggestions, on doing UK with gstat, I found some
      >As this were general, I decided to post this message for the list because
      >other people may encoutered similar situations.
      >I could not manage to make UK with a covariate work...
      >For example:
      >vgm1 <- variogram(log(zinc)~elev, ~x+y, meuse)
      >m=fit.variogram(vgm1, vgm(1,"Sph",300,1))
      >plot(vgm1, model=m)#(this worked fine)
      ># However when doing krige, it does not worked. I tried with dif. data
      >sets,.... and always similar.
      >x <- krige(log(zinc)~c(elev), ~x+y, model = m, data = meuse, newd =
      >#Error in eval(expr, envir, enclos) : Object "elev" not found
      >x <- krige(log(zinc)~meuse$elev, ~x+y, model = m, data = meuse, newd =
      >#Error in predict.gstat(g, newdata = newdata, block = block, nsim =
      >nsim, : dimensions do not match: locations 6206, nrows in X 155
      >Maybe the covariate for the kriging should be the predictions for all the
      >borded area (similar to geoR)????
      >Like this:

      #So for example, if I additionally do (just playing not seriously....):

      vgm2 <- variogram(elev~1, ~x+y, meuse)
      m2=fit.variogram(vgm2, vgm(1,"Sph",300,1))

      plot(vgm2, model=m2)#(this worked fine)
      k.elev <- krige(elev~1, ~x+y, model = m2, data = meuse, newd = meuse.grid)
      #### So we have a prediction of the covariate for each location within the grid
      ## And after:

      x <- krige(log(zinc)~k.elev$var1.pred, ~x+y, model = m, data = meuse, newd
      = meuse.grid)

      >I just tried it and it does not work as well....
      >What am I doing wrong?
      >Thank you in advance for any help,
      >All the best

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.