Am 14.02.2014 23:39, schrieb Michael Boldin:
I am estimating a model by passing a list of variables and extra
items
in bundle to a user defined function
I would like to be able to print out results that include the
effective sample period in the same way the OLS procedure does
I.e.
smpl 1995:4 2012:4
list xlist= x1 x2 x3 x4
ols y const xlist
prints ==>
Model 1: OLS, using observations 1985:1-2012:4 (T = 112)
Dependent variable: y
... plus results ...
My function would be defined as
function bundle bestimate(list xlist, bundle bmodel)
...
end function
In my case it is most convenient to put all variables in xlist and
pull out the first as the dependent variable. I can figure
everything I need except how to capture the smpl dates for a printout.
Any suggestions? I would especially like to be able to show the
effective dates for any cases where lags create missing observations
or the data ends before the last smpl date.
I think you should be able to do that using some "accessors" plus
perhaps a couple of built-in conversion functions:
1) I guess you knew already that $t1 and $t2 give you the obs numbers of
the current sample. You're right that (I think) this need not be the
effective sample due to lags etc., especially because the behavior
inside functions is a bit tricky to predict (depends on whether
pre-sample values exist, for example). But you could compare $t2 - $t1 +
1 with $T, which gives the total number of obs in the last model. Only
if these differ you would have to put in further checking efforts. Apart
from that, I think it could be worthwhile to add to gretl accessors to
somehow grab directly the effective sample.
2) To convert the obs numbers into readable dates, use the function
obslabel() which returns a string.
hth,
sven