gstat icon indicating copy to clipboard operation
gstat copied to clipboard

A error in "use krige"

Open OrdinarySK opened this issue 5 years ago • 7 comments

kr.lst <- krige(formula = lst~longtitude+latitude+slope+evelation, data=sa, newdata=grid.grid, model=fvlst)

error information: Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘krige’ for signature ‘"formula", "missing"’

my sa contains longtitude,latitude,slope,evelation,lst and so on column grid.grid contains longtitude,latitude fvlst is fit.variogram result

OrdinarySK avatar May 09 '20 12:05 OrdinarySK

Try not naming the arguments, as in

krige(lst~longtitude+latitude+slope+evelation, sa, grid.grid, model=fvlst)

edzer avatar May 09 '20 14:05 edzer

I tried again as you said. error:"Error in eval(predvars, data, env) : not find object 'slope' " “slope” is include in sa, why such error occurs?

OrdinarySK avatar May 13 '20 12:05 OrdinarySK

It needs to be in grid.grid as well.

edzer avatar May 13 '20 12:05 edzer

I don't quite understand. user manual example krige(log(zinc)~1, meuse, meuse.grid, model = m) The example data "meuse and meuse.grid", meuse.grid as a GRID data not contains zinc, zinc is include in meuse. why is this ok? As far as i am concerned, In my data, "sa" is the sampling points, including other environmental covariates and target variable. “grid.grid” is the gridded study area GRID data, only contains longtitude and latitude. why "slope" needs to be in "grid.grid" as well? So, Is this my idea wrong?

OrdinarySK avatar May 13 '20 13:05 OrdinarySK

slope is on the RHS of the formula, meaning it is a predictor; for prediction, you need to have all predictors at prediction locations.

edzer avatar May 13 '20 14:05 edzer

Okay, I understand roughly, thank you.

OrdinarySK avatar May 13 '20 14:05 OrdinarySK

Excuse me, I have the other question. How do I determine the size of the parameter range when using fit.lmc. Because of my three target variables have different range base on “Spherical” model.

OrdinarySK avatar May 17 '20 09:05 OrdinarySK