r-spatial / gstat

Spatial and spatio-temporal geostatistical modelling, prediction and simulation
http://r-spatial.github.io/gstat/
GNU General Public License v2.0
194 stars 49 forks source link

Space-time cross variogram with gstat #5

Closed MaximeBeauchamp closed 7 years ago

MaximeBeauchamp commented 8 years ago

Hi,

Would it be possible to create a space-time cross variogram with the variogram function. Maybe by using a gstat object instead of a formula as a first argument. But maybe it is a too big modification for the gstat library.

In that case, I'd like to try to modify the code of the variogramST function by myself to get the cross-variogram between 2 variables of my spacetime object.

Is it possible ?

Maxime Beauchamp INERIS Geostatistics Modeling Engineer

edzer commented 8 years ago

Hi Maxime, way to go - I would try the same. You may want to make variogramST an S3 method, with instances for formula and gstat. I'd be happy to receive pull requests, or just working code.

MaximeBeauchamp commented 8 years ago

Hi Edzer,

Sorry for the delay of my response (I was in paternity leave) ! Ok I managed to create my crossvariogramST with this kind of header (see the attached file for the code) :

cross_variogramST = function(formula1, formula2, locations, data, ..., tlags = 0:15, cutoff, width = cutoff/15, boundaries=seq(0,cutoff,width), progress = interactive(), pseudo = TRUE, assumeRegular=FALSE, na.omit=FALSE)

For sure it is not as clean as an S3 method but it was easier to implement and to use once gstat is loaded. I guess I have now to find a way to fit an authorized model for this !

Maxime

variogramST_functions.zip

edzer commented 8 years ago

On 20/07/16 16:03, MaximeBeauchamp wrote:

Hi Edzer,

Sorry for the delay of my response (I was in paternity leave) ! Ok I managed to create my crossvariogramST with this kind of header (see the attached file for the code) :

cross_variogramST = function(formula1, formula2, locations, data, ..., tlags = 0:15, cutoff, width = cutoff/15, boundaries=seq(0,cutoff,width), progress = interactive(), pseudo = TRUE, assumeRegular=FALSE, na.omit=FALSE)

For sure it is not as clean as an S3 method but it was easier to implement and to use once gstat is loaded. I guess I have now to find a way to fit an authorized model for this !

If you want me to look at it, I'd need example code.

What do you mean by authorized model?

Best regards,

Maxime

variogramST_functions.zip https://github.com/edzer/gstat/files/373845/variogramST_functions.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/edzer/gstat/issues/5#issuecomment-233958537, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfykyWa9klR9hPsz0QjNTXP2WpxTqXiks5qXiqZgaJpZM4ISCJp.

Edzer Pebesma Institute for Geoinformatics (ifgi), University of Münster Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081 Journal of Statistical Software: http://www.jstatsoft.org/ Computers & Geosciences: http://elsevier.com/locate/cageo/ Spatial Statistics Society http://www.spatialstatistics.info

MaximeBeauchamp commented 8 years ago

I attached a zip file with the code of the cross-variogram ST function in my previous response. I guess it works fine on my data (my field of interest is air quality modelling). By "authorized" I mean fit the model. Maybe I'll try the linear model of coregionalisation of De Iaco for the product-sum model as a first try.

Maxime

edzer commented 7 years ago

I can't see the attachment.

edzer commented 7 years ago

@MaximeBeauchamp any news on this one, or time to close this issue?