On Thu, 24 Sep 2015, Allin Cottrell wrote:
On Thu, 24 Sep 2015, Raul Gimeno wrote:
>
> Would it be possible to include a solver function like in Excel in order to
> do minimizing calculations to find the optimal alpha?
The BFGSmax function can do this sort of thing. See the chapter on
Numerical methods in the User's Guide.
In fact the "nls" command should do the job more simply, as in:
<hansl>
series S = S0
nls y = S
S = S0
S = alpha * y(-1) + (1-alpha) * S(-1)
params alpha
end nls -v
</hansl>
where y is a data series, S is the series to hold the EMA, and S0 and
alpha are suitably initialized scalars. (This is the Hunter variant of
EMA, where S(t) is based on y(t-1) rather than y(t).)
Allin Cottrell