[Rd] pretty.Date(): new "halfmonth" time step

Felix Andrews felix at nfrac.org
Thu May 20 13:14:55 CEST 2010


I see, an interesting perspective.

The current purpose is just to look pretty, or to follow "the
principle of least surprise", which is difficult to the extent that it
is subjective and sometimes context dependent...

Cheers
-Felix

On 20 May 2010 17:38, Daniel Murphy <chiefmurphy at gmail.com> wrote:
> Felix,
> I see your point about the "halfway" point acting like the first day of the
> month in its relativity to the ending date of the month: they're both
> variable.
> I'm an actuary. Like accountants, actuaries tend to measure "financial" time
> in months because of how the books close. But in our mathematical models
> time takes on a continuous nature. So our problem is how to build a computer
> representation of time that reflects both its continuous nature as well as
> the varying-length, "discrete" nature of financial months. I've found that a
> fixed value for a halfway point complicates actuarial calculations. It could
> serve other purposes just fine, however.
> Best regards,
> Dan
>
> On Wed, May 19, 2010 at 7:48 PM, Felix Andrews <felix at nfrac.org> wrote:
>>
>> On 20 May 2010 11:56, Daniel Murphy <chiefmurphy at gmail.com> wrote:
>> >>Much better to implement directly what this is trying to do: i.e. to
>> >>have a "halfmonth" time step. This is just the union of two "monthly"
>> >>sequences, one on the 1st of each month and another on the 15th of
>> >>each month.
>> >
>> > For some applications that might be true. But not for others. For a
>> > month
>> > with 31 days, there are 14 days before the 15th of the month and 16 days
>> > after the 15th, so, for example, March 16th (specifically noon) rather
>> > than
>> > March 15th would be the halfway point if you define "halfway" in terms
>> > of
>> > the distances to the beginning and end of the month. For a month with 30
>> > days -- like April -- the halfway point would be the instant between the
>> > 15th and the 16th of the month. Do you label that instant April 15 or
>> > April
>> > 16?  (I prefer "15".) Don't get me started on February.
>>
>> Dan, you are correct: the midpoint of a 30 day month is the 16th at
>> 00:00. That instant is called the 16th according to print.POSIXt.
>>
>> junstart <- as.POSIXct("2000-06-01 00:00", tz="GMT")
>> julstart <- as.POSIXct("2000-07-01 00:00", tz="GMT")
>> junstart + ((julstart - junstart) / 2)
>> #[1] "2000-06-16 GMT"
>>
>> How embarassing...
>> So I think it would be better to use 16 rather than 15 for the
>> "halfmonth" time step.
>>
>> Yes, months have variable lengths, but I think it is best to use a
>> consistent date (the 16th) than to calculate exact midpoints, just as
>> a normal monthly series has a consistent date (the 1st) and has
>> variable lengths.
>>
>> Regards
>> -Felix
>>
>>
>> >
>> > - Dan Murphy
>> >
>> >        [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-devel at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-devel
>> >
>>
>>
>>
>> --
>> Felix Andrews / 安福立
>> Postdoctoral Fellow
>> Integrated Catchment Assessment and Management (iCAM) Centre
>> Fenner School of Environment and Society [Bldg 48a]
>> The Australian National University
>> Canberra ACT 0200 Australia
>> M: +61 410 400 963
>> T: + 61 2 6125 4670
>> E: felix.andrews at anu.edu.au
>> CRICOS Provider No. 00120C
>> --
>> http://www.neurofractal.org/felix/
>
>



-- 
Felix Andrews / 安福立
Postdoctoral Fellow
Integrated Catchment Assessment and Management (iCAM) Centre
Fenner School of Environment and Society [Bldg 48a]
The Australian National University
Canberra ACT 0200 Australia
M: +61 410 400 963
T: + 61 2 6125 4670
E: felix.andrews at anu.edu.au
CRICOS Provider No. 00120C
-- 
http://www.neurofractal.org/felix/



More information about the R-devel mailing list