creating xts object

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

creating xts object

MSameti
Dear all

I’m working with monthly spatio-temporal data. I have a question about
creating spatio-temporal object.

When I wanted to create time series, I used as.yearmon function. After that
when i create purely spatial variogram from empirical spatio-temporal
variogram (spEmpVgm <- empVgm[empVgm$timelag == 0,]) , it shows only
January in time lag==0. Is it true or not?

Should I change the method of creating xts object?


Thanks alot

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: creating xts object

Dr. Benedikt Gräler
I tried to re-build the issue with a small toy example (see below). Like
you, I also observe that the "timelag" column only denotes Jan 0000. But
this is due to the fact that yearmon of "0" difference is Jan 0000.
Checking also the values of empVgm and the wireframe plot indicates that
sensible temporal differences have been calculated in this toy example
(multiples of the fraction 1/12: yearmon(0/12) = Jan 0000, yearmon(1/12)
= Feb 0000, ...). I suggest to also double check your empirical
spatiotemporal variogram.

HTH,

  Ben

-/R-Script/-

library(xts)
library(spacetime)
library(gstat)

stfdf <- STFDF(SpatialPoints(cbind(runif(10), runif(10))),
                yearmon(x = 0:23/12+2015),
                data.frame(var=rnorm(10*24)))

empVgm <- variogramST(var~1, stfdf, tlags = 0:5, boundaries = 1:5/10)
empVgm
plot(empVgm, wireframe=T, scales=list(arrows=F))

spEmpVgm <- empVgm[empVgm$timelag == 0, ]
class(spEmpVgm) <- c("gstatVariogram", "data.frame")
spEmpVgm
plot(spEmpVgm)

yearmon(0)




On 16/10/2017 17:59, Mahsa Sameti wrote:

> Dear all
>
> I’m working with monthly spatio-temporal data. I have a question about
> creating spatio-temporal object.
>
> When I wanted to create time series, I used as.yearmon function. After that
> when i create purely spatial variogram from empirical spatio-temporal
> variogram (spEmpVgm <- empVgm[empVgm$timelag == 0,]) , it shows only
> January in time lag==0. Is it true or not?
>
> Should I change the method of creating xts object?
>
>
> Thanks alot
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> 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: [hidden email]
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

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

b_graeler.vcf (458 bytes) Download Attachment