El vie, 12-02-2010 a las 13:44 -0500, Allin Cottrell escribió:
On Fri, 12 Feb 2010, Ignacio Diaz-Emparanza wrote:
> With periodicity ($pd)> 1 (quarterly or monthly data,..)
> y[1] is refering to the first observation of the series,
> but with annual data it is refering to the observation of year '1'.
Duh, sorry, I wasn't paying enough attention. I'll think about it,
but here's a quick work-around:
<script>
open data3-6
series y = Ct
series s1 = 0
scalar d = 0.5
scalar T = $nobs
loop t=1..T
s1[t] = (t==1) ? y[t] : d*y[t]+ (1-d)*s1[t-1]
endloop
print y s1 -o
</script>
Allin
Oh, yes it works ! I did not try with 't' because I thought it was an
alias of 'obs', given the explanation in the function reference:
<quotation>
obs
Output: series
Returns a series of consecutive integers, setting 1 at the start of the
dataset. Note that the result is invariant to subsampling. This function
is especially useful with time-series datasets. Note: you can write t
instead of obs with the same effect.
See also obsnum.
</quotation>
This definition does not seems to be totally correct given the different
behaviour of 'obs' for annual data.
I agree with Sven in that sometimes it is not clear if we are treating
with a number or with a string.
I also agre with Helio's suggestion of separating the string (obs.year)
and the number (obs) of each observation entry. I was thinking that to
have a notation consistent for all the periodicities It would be better
to use 'obs.date' to note the string of the date and 'obs' for the
integer index, but now I see that 't' is already working always as
integer entry, so the solution may be:
1- to define "obs.date" as (only) the string of the date and leaving
'obs' as it is now (to avoid backward incompatibilities, and deprecate
in the future), or
2- as 'obs' works as 'obs.date' for annual data, and for monthly or
seasonal data is already detected as string when writing the date label,
we don't need a new function, we only need that a litle paragraph about
the different behaviour of the 't' function be added to the 'genr' entry
in the manual. (But yes, Sven, we are maintaining the mixture of strings
and numbers in 'obs' in this case)
--
Ignacio Diaz-Emparanza
DEPARTAMENTO DE ECONOMÍA APLICADA III (ECONOMETRÍA Y ESTADÍSTICA)
UPV/EHU
Avda. Lehendakari Aguirre, 83 | 48015 BILBAO
T.: +34 946013732 | F.: +34 946013754
www.ea3.ehu.es