[R-sig-Geo] How to fit a pure spatial variogram on a spatio-temporal empirical one
Dr. Benedikt Gräler
b.graeler at 52north.org
Tue May 30 10:48:37 CEST 2017
Dear Carlo,
the code below is a bit of a hack, but does what you are asking for. The
classes "gstatVariogram" and "StVariogram" have slight different design
and so do the functions fit.variogram and fit.StVariogram. Note that
spVv is now a pooled variogram across all time steps of your dataset
treating each time slice as an independent copy of the same pure spatial
process (i.e. strong temporal autocorrelation might influence your
estimation).
HTH,
Ben
library(gstat)
data("vv")
plot(vv)
spaceOnly <- vv$timelag == 0
spVv <- cbind(vv[spaceOnly,],
data.frame(dir.hor=rep(0, sum(spaceOnly)),
dir.ver=rep(0, sum(spaceOnly))))
# drop empty (NA) first row
spVv <- spVv[-1, ]
# manually re-class
class(spVv) <- c("gstatVariogram","data.frame")
plot(spVv)
fitSpVgm <- fit.variogram(spVv, vgm(30, "Exp", 150, 10))
plot(spVv, fitSpVgm)
On 29/05/2017 20:13, Carlo Cavalieri wrote:
> Hi, I am using the R package GSTAT to make a spatio-temporal interpolation for my thesis and I wanted to know if it was possible to obtain the pure spatial empirical variogram from the spatio-temporal so that I can use it to fit a pure spatial variogram, for example exponential.
> Unfortunately fit.variogram only accepts objects output of variogram, not of variogramST. One possible solution could be to extract tlag=0 from the StVariogram and convert the output to class variogramModel, but I have no idea on how to do this.
> I look for a way to do this because fit the spatial variogram for each day separately is not a good idea given the small number of observation stations.
>
> One way is definitely possible since the authors of the paper "Spatio-Temporal Interpolation using gstat” managed to compare the results of pure spatial and spatio-temporal interpolation (that is what I want to do): Below a quotation from that paper.
>
> "For comparison with classical approaches, we interpolate across Germany iteratively for each single day using all available data for variogram estimation. The purely spatial empirical variogram can directly be obtained from the empirical spatio-temporal variogram, by fixing the temporal lag at 0 separation. From the same set of variogram models as investigated for the spatio-temporal models, the exponential model (partial sill: 66.5, range: 224 km, nugget: 13.5) is the best suited based on the optimisation criterion.”
>
> Does anyone have any idea?
> Thank you
> Carlo
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Dr. Benedikt Gräler
52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
48155 Muenster, Germany
E-Mail: b.graeler at 52north.org
Fon: +49-(0)-251/396371-39
Fax: +49-(0)-251/396371-11
http://52north.org/
Twitter: @FiveTwoN
General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b_graeler.vcf
Type: text/x-vcard
Size: 422 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170530/a7bc1969/attachment.vcf>
More information about the R-sig-Geo
mailing list