close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 9 years ago

Last modified 9 years ago

#1925 new defect

Error and enhancement in InvChEx function

Reported by: César Pérez Álvarez Owned by: Víctor de Buen Remiro
Priority: normal Milestone: Mantainance
Component: Packages Version: 3.3
Severity: major Keywords:
Cc:

Description

When we use InvChEx with a time series which has a 0 MaxS, it generates a non-zero expansion where we had to be a zero value.

Example:

Serie anu = -SubSer(Pulse(y2000m01d01, Anual), y2000, y2002);
Serie mon = InvChEx(anu, Monthly);

I would like to enhance this function to expand the outcome time series which all dates "in last date" of input time series.

This correction I think solve all problems:

Serie InvChExNew(Serie ser, TimeSet dtn)
{

Date end = Succ(Succ(Last(ser), Dating(ser), 1), dtn, -1);
Date ini = First(ser);

Real num = MaxS(ser)+1;
Serie ind = CalInd(C, dtn)*num;
Expand(SubSer(InvCh(ser, ind)>>ind, ini, end),num)

};

Serie monNew = InvChExNew(anu, Monthly);

You can compare different outputs time series between mon and monNew to see it works.

Its important to explain in description that Dating(ser) and dtn in InvChEx must be harmonic between them.

Change History (1)

comment:1 Changed 9 years ago by César Pérez Álvarez

An example of the new function to include in stdlib/general/grammars/_serie.tol in stdlib package


Serie InvChEx(Serie ser, TimeSet dtn)


{

Date end = Succ(Succ(Last(ser), Dating(ser), 1), dtn, -1);
Date ini = First(ser);

Real num = MaxS(ser)+1;
Serie ind = CalInd(C, dtn)*num;
Expand(SubSer(InvCh(ser, ind)>>ind, ini, end),num)

};

PutDescription(I2(

"Generates a new time series doing an inverse dating change of time series "
"ser to TimeSet dtn filling new dates which values from ser. "
"Dating of ser must be harmonic with dtn.",
"Hace el cambio de fechado inverso de la serie ser a dtn rellenando "
"las nuevas fechas de la serie con el valor que toma ser "
"en la fecha que hereda valor directamente. El fechado de la serie "
"ser y dtn han de ser armónicos entre si."),
InvChEx);


Note: See TracTickets for help on using tickets.