Jack,
Thank you for your hint. By "shares", do you mean the "SSR" values?
Indeed, in your example, they are around 50 and using my data SSR starts at around 0,01
and converges towards 0,00632... and stops after 49 iterations. This is when gretl tells
me that the jacobian cannot be calculated.
If you mean the w's, my estimated w5 (if I only use x1...x5) is zero
(0,0000000039...).
Except for choosing other data/independent variables. Is there any way to work around
that?
Another question that I was asking myself, concerns the t-values (or standard errros). As
they are calculated for the b's, they likely have to be transformed to represent
t-values for the estimated w's. I guess this has to be done in another way, then just
using exp() and divide it by exp(bi)/(1+sum(exp(...)).
One possibility that I can imagine is to use the w's from the nls estimation and,
calculate the "residuals" for the linear model (which is bluntly the way how it
would be done via standard OLS). But I could also imagine that this might lead to grossly
misleading standard error estimates.
All the best,
Jan
-----Ursprüngliche Nachricht-----
Von: Plus.line MailSystem [mailto:cyrus@mailer.plusline.de] Im Auftrag von Riccardo (Jack)
Lucchetti
Gesendet: Mittwoch, 30. April 2014 12:16
An: Gretl list
Betreff: Re: [Gretl-users] Non-linear least squares
On Wed, 30 Apr 2014, Jan Tille wrote:
Sven,
thank you for clarification.
Afterwards, I tried to adapt Jack's code to my problem (I have six
independent variables x1...x6, therefore I think I need b1...b5
parameters, with exponential transformations e1...e5 and expand the
den to den=1+e1+...+e5 to finally get w1...w5).
That's correct.
This, however lead me to another problem. The calculation of the
jacobian failed. I guess this is due to multicollienarity issues
(correlations are high - between 0.83 and 0.97) and because it works,
when I omit x6 and adapt the model accordingly. I also tried standard
OLS-Coefficients as starting values for the b's but it did not change
(which might be no surprise).
That's also likely to happen when one or more of your "shares" are near 0.
See what happens with analytical gradients, as in
<hansl>
nls y = w1 * x1 + w2 * x2 + (1-w1-w2) * x3
e1 = exp(b1)
e2 = exp(b2)
den = 1 + e1 + e2
w1 = e1 / den
w2 = e2 / den
deriv b1 = w1 * (1-w1) * x1
deriv b2 = w2 * (1-w2) * x2
end nls --verbose
</hansl>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------