0

I am trying to use the function variogramST from the R package gstat to calculate a spatio-temporal variogram.

There are 12 years of data with 20'000 data points at irregular points in space and time (no full grid or partial grid). I have to use the STIDF from the spacetime package for an irregular data set. I would like a temporal semivariogram with reference points at 0, 90, 180, 270 days, up to some years etc. Unfortunately both computational and memory problems occur. When the command

samplevariogram<-variogramST(formula=formula_gstat,data=STIDF1)

is run without further arguments, the semiovariogram is taking into account only very short time periods in terms of reference points for the semivariogram, which does not seem to capture the inherent data structure appropriately.

There are more arguments for this function at the user's disposal, but I am not sure how to parametrize them correctly: tlag, tunit, twindow. Specifically, I am wondering how they interact and how I achieve my goal as described above. So I tried the following code

samplevariogram<-variogramST(formula=formula_gstat,data=STIDF1,tlag= ...., tunit=... , twindow= ...)

The following code results ist not working due to memory issues in my 32Gbyte RAM computer:

samplevariogram<-variogramST(formula=formula_gstat,data=STIDF1,tlag=90*(0:20), tunit="days")

but might be perhaps flawed, otherwise. Furthermore, the latter line of code also seems infeasible in terms of computation time.

Does someone know how to specify the variogramST-function from the gstat packaging correctly, aiming at the desired time intervals?

Thanks

user823
  • 265
  • 2
  • 14
  • Have you tried out alternatives with a smaller (random) subset of your data, in order to get a feel for what is going on? Have you tried to set your time step to 90 days, e.g. replace time with 1, 2, 3, etc reflecting day 0, 90, 180, etc.? – Edzer Pebesma Aug 02 '16 at 21:34
  • 1
    How do I set up the time steps (of 90 days) correctly? How about "samplevariogram<-variogramST(formula=formula_RENT_gstat,data=STIDF1,tunit="days",twindow=90,tlags=0:6)"? – user823 Aug 03 '16 at 16:08
  • 1
    Alternatively, do I have to use the POSIXct format to specify the time index when creating the STIDF object from the spacetime package? Do you mean that I should map my time data onto a smaller interval for which an appropriate "tunit"-argument is available? – user823 Aug 03 '16 at 17:56
  • Lots of questions. Have you considered providing a reproducible example? – Edzer Pebesma Aug 03 '16 at 21:30

1 Answers1

0

If I understand correctly, the twindow argument should be the number of observations to include when calculating the space-time variogram. Assuming your 20k point are distributed more or less evenly over the 12 years, then you have about 1600 points per year. Again, assuming I understand things correctly, if you wanted to include about two years of data in temporal autocorrelation calculations, you would do:

samplevariogram<-variogramST(formula=formula_gstat,data=STIDF1,tlag=90*(0:20), tunit="days",twindow=2*1600)
user3004015
  • 617
  • 1
  • 7
  • 14