I'm new in spatio-temporal analysis in r so I don't know if what I'm doing is right. I have a lot of spatio-temporal data and I would like to plot a spatio-temporal sample variogram.
My problem is that I don't really understand how variogramST
(package: gstat) works. Is spacelag
in km or what?
This is what I've done by now:
var_st <- variogramST (datast~1, data=DF, tunits="days", tlags=seq(0, 93, by= 31),
boundaries=seq(0, 100, by=25), na.omit=T, assumeRegular=F)
My second question is:
Is it plotting variogram at exact distance 25, 50, 75, 100? For example, if two cities have a distance e.g 12 is variogramST
considering it? Or is it just considering pairs of observation with exact distance 25, 50, 75, 100?
Moreover, I have monthly data. I read that in this case the best option is to choose tunits="days"
and I choose tlags=seq(0, 93, by= 31)
, is it right? I don't know how to deal with it otherwise.
Thank you very much for all of those people who are going to answer me!
The spatial distance unit depends on the coordinate reference system of your input data, see sp::spDistsN1 for details.
The empirical variogram relies on a binning - distance classes. Observations in space and time are grouped by their approximate spatial distance (e.g. 0 km to 25 km; 25 km to 50 km, ... according to
cutoff
,width
andboundaries
). In time, it also depends on the class of the object you provide to variogramST:tlags
are evaluated as ids of the time slot of the STFDF, in your case observations at the same time id, with 31, 62 and 93 ids difference - most likely not what you want, assuming every id in the time slot ofDF
refers to a new month, you need to use 0:3. The argumenttunit
has no effect here.tlags
are used as the breaks between classes with the temporal unittunit
.See the package spacetime for details on the representation of spatio-temporal data as STFDF, STSDF, and STIDF.
HTH