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 ?xing 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
How to fit a pure spatial variogram on a spatio-temporal empirical one
3 messages · Carlo Cavalieri, Dr. Benedikt Gräler
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 ?xing 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>
Thank you very much Ben, the code works perfectly. I have 2 years time series, one for each station, of daily mean average pm10 which I have detrended wrt mean and standard deviation by using land use coefficients. The problem I am trying to face is to distinguish between the spatial and the temporal components of the correlation among time series, the former due to distance, the latter mostly due to seasonality. Does the pooled variogram obtained with the code you posted here isolates the temporal component of the correlation and only assume constant covariance structure over time or is it influenced by seasonality?
Il giorno 30 mag 2017, alle ore 10:48, Dr. Benedikt Gr?ler <b.graeler at 52north.org> ha scritto:
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 ?xing 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 <b_graeler.vcf>
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo