Re: [R] its package: inexplicable date-shifting ?!

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Thu 28 Apr 2005 - 04:56:58 EST

I don't use 'its' enough to really know but usually when you see dates off by one and are using POSIXct (which has time zone support) -- POSIXct is what
'its' uses, it signals that the time zone is different than what you expected.
 Try to specify the time zone explicitly if 'its' supports it. Another possibility
is to use the 'zoo' package which can handle 'Date' class dates (as well as 'POSIXct' and others). Since 'Date' does not support time zones you can't get into that sort of trouble in the first place.  See the article in RNews 4/1 on dates classes for background info on dates in R.

 On 4/27/05, Chalasani, Prasad <prasad.chalasani@gs.com> wrote:
>
> Can someone please explain to me why
> the dates get shifted by one day
> when I create an its ( irregular time-series )
> object from a matrix for which I've
> assigned row names.
> E.g. in the example run below,
> why does the its object have dates
> one-shifted from my original dates?
>
> > install.packages('its')
> > install.packages('Hmisc')
> > require(its)
> > m <- matrix(1:2, nrow=2)
> > m
> [,1]
> [1,] 1
> [2,] 2
> > its.format('%Y%m%d')
> [1] "%Y%m%d"
> > rownames(m) <- c('20040813', '20040814')
> > m
> [,1]
> 20040813 1
> 20040814 2
> > its(structure(m))
> 1
> 20040812 1
> 20040813 2
>
> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Berton Gunter
> Sent: Wednesday, April 27, 2005 1:28 PM
> To: ltorgo@liacc.up.pt
> Cc: r-help@stat.math.ethz.ch
> Subject: RE: [R] Recursive calculation of a series of values
>
> Algebra:
> cumprod(1+v)*x[0]
>
> -- Bert Gunter
> Genentech Non-Clinical Statistics
> South San Francisco, CA
>
> "The business of the statistician is to catalyze the scientific learning
> process." - George E. P. Box
>
> > -----Original Message-----
> > From: r-help-bounces@stat.math.ethz.ch
> > [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Luis Torgo
> > Sent: Wednesday, April 27, 2005 7:42 AM
> > To: r-help@stat.math.ethz.ch
> > Subject: [R] Recursive calculation of a series of values
> >
> > Dear R-users,
> >
> > I'm felling kind of blocked on a quite simple problem and I wonder if
> > someone could give me a help with it.
> >
> > My problem:
> >
> > x[0] = 100
> > x[1] = (1+v[1])*x[0]
> > x[2] = (1+v[2])*x[1]
> > ...
> >
> > i.e.
> >
> > x[i] = (1+v[i])*x[i-1]
> > and x[0]=k
> >
> > Given a set of v values I wanted to obtain the corresponding
> > x values in
> > an efficient way (i.e. without a for loop).
> >
> > For instance, if x[0] = 100 and v = c(0.2,-0.1,0.05) then I would get
> > x = c(120,108,113.4)
> >
> > I'm almost sure the function filter() from package tseries is the key
> > for getting these values but I'm really blocked.
> >
> > Any help is much appreciated.
> >
> > Luís Torgo
> >
> > --
> > Luis Torgo
> > FEP/LIACC, University of Porto Phone : (+351) 22 339 20 93
> > Machine Learning Group Fax : (+351) 22 339 20 99
> > R. de Ceuta, 118, 6o email : ltorgo@liacc.up.pt
> > 4050-190 PORTO - PORTUGAL WWW :
> > http://www.liacc.up.pt/~ltorgo
> >
> > ______________________________________________
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Apr 28 05:03:11 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:27 EST