Juan, Tanks for your answer and sorry for the confusion that was just a chronological order. 

First step was nls which returned the error message
Second step: defined the scalars (which I wrote before the the nls code
Third step: Re estimated nls, with arbitrarily defined scalars

i.e. scalars = ... (...) nls...end nls

However, as discussed in the 2008 thread, I wanted to 'constrain' the coefficients to be non-negative, but nls returned a negative estimate on w5.

An alternative is to set up a quadratic programming excel solver model. I wanted to use nls, to a) verify my excel results an b) to retrive some standrad errors, for t-Tests.

Kind regards,

Jan 

Von meinem iPad gesendet

Am 29.04.2014 um 18:38 schrieb "Juan C. Estévez" <ecadrian.estevez@usc.es>:

Dear All,

I was trying to estimate a non-linear least squares regression and found the following discussion from April 2008.

http://lists.wfu.edu/pipermail/gretl-users/2008-April/002337.html

I changed the code, so that it would accommodate my “model”. All Xi’s as well as Y are time series. Unfortunately, when I estimate the model, I get an error: b1: expect scalar or vector.


... But don´t you get this error because you define the scalars after de 'nls ... end nls' command, instead of defining them before?

nls Y= w1*X1+ w2*X2 + w3*X3 + w4*X4 + w5*X5 + w6*X6

    w1=b1^2

    w2=b2^2

    w3=b3^2

    w4=b4^2

    w5=b5^2

    w6=1-w1-w2-w3-w4-w5

    params b1 b2 b3 b4 b5

end nls

 

After this, I tried to define arbitrary scalars as starting values (no theory, just numbers that came to my mind)

scalar b1=0.1

scalar b2=0.2

scalar b3=-0.05

scalar b4=0.03

scalar b5=-0.015

_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users