Simple variogram in R, understanding gstat::variogram() and object gstat -
i have data.frame
in r variables represent locations , observations measures of variable in locations. want measure decay of dependence locations depending on distance, variogram comes particularly useful studies.
i trying use gstat
library bit confused parameters. far understand (empirical) variogram should need basic data:
- the locations of variables
- observations these variables
and other parameters maximun distance, directions, ...
now, gstat::variogram()
function requires first input object of class gstat. checking documentation of function gstat()
see outputs object of class, function requires formula
argument, described as:
formula defines dependent variable linear model of independent variables; suppose dependent variable has name z, ordinary , simple kriging use formula z~1; simple kriging define beta (see below); universal kriging, suppose z linearly dependent on x , y, use formula z~x+y
could explain me formula for?
try
methods(variogram)
and you'll see gstat has several methods variogram, 1 requiring gstat object first argument.
given data.frame, easiest use formula method:
variogram(z~1, ~x+y, data)
which specifies in data
, z
observed variable of interest, ~1
specifies constant mean model, ~x+y
specify coordinates found in columns x
, y
of data
.
Comments
Post a Comment