Code: Select all
*===============================
seed 100
set(first=0.0) x 1 100 = .9*x{1}+%ran(1.0)
set x = x+6.0
*===============================
clear stdf
do regend = 80, 99
boxjenk(noprin,const,ar=1,define=lineareq) x 1 regend
set linearstdf regend+1 regend+1 = %sigmasq
uforecast(equation=lineareq,from=regend+1,steps=1) linearf
end do regend
prin / linearstdf linearf
sstats 81 100 %logdensity(linearstdf,x-linearf)>>linlpds
disp linlpds
*===============================
clear logstdf
set logx = log(x)
do regend = 80, 99
boxjenk(noprin,const,ar=1,define=logeq) logx 1 regend
set logstdf regend+1 regend+1 = %sigmasq
uforecast(equation=logeq,from=regend+1,steps=1) logf
end do regend
prin / logstdf logf
sstats 81 100 %logdensity(logstdf,log(x)-logf)-log(x)>>loglpds
disp loglpds
*===============================
clear sqrtstdf
set sqrtx = sqrt(x)
do regend = 80, 99
boxjenk(noprin,const,ar=1,define=sqrteq) sqrtx 1 regend
set sqrtstdf regend+1 regend+1 = %sigmasq
uforecast(equation=sqrteq,from=regend+1,steps=1) sqrtf
end do regend
prin / sqrtstdf sqrtf
sstats 81 100 %logdensity(sqrtstdf,sqrt(x)-sqrtf)-log(2*sqrt(x))>>sqrtlpds
disp sqrtlpds
(i) The LPDS for LOG and SQRT are not calculated on the back-transformed forecasts, rather can only be calculated on the transformed scale. Right?
(ii) In acLPDS.src I have
procedure acLPDS actual fcast start end stdsq
*
type series actual fcast
type integer start end
type real stdsq
For multi-step ahead forecasts I only need 1 %sigmasq (and it's a REAL).
I would like acLPDS.src to be able to handle both forecasting schemes. For one-step ahead forecasts I need all %sigmasq's as a series and aligned to actual and fcast. But stdsq cannot both be a (single) REAL and a SERIES. So if I try for one-step ahead's
procedure acLPDSS actual fcast stdsq start end
*
type series actual fcast stdsq
this won't work for multi-step ahead forecasts, the %sigmasq (stdsq) is a REAL not a SERIES (and doesn't have to be aligned). And I have to include all parameters in order when running except for the start and end.
Obviously, I can write a seperate procedure for one-step ahead, but that's not ideal.
(iii) %sigmasq is not in the output at the top of BOXJENK. What is the formula for %sigmasq?
(iv) I have included
inquire(reglist) startl<<start endl<<end
# actual fcast
in all of the procedures I've written so I don't have to explicitly put in start and end value's/date's. I have always wondered what does this exactly do i.e. why the reglist even though there are no regressions to be estimated?