On Tue, 29 Apr 2014, Jan Tille wrote:
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.
nls Y= w1*X1+ w2*X2 + w3*X3 + w4*X4 + w5*X5 + w6*X6
[...]
Correct me if I'm wrong, but it looks to me as if what you want to
estimate is in fact a linear model: only, you want to constrain the
parameters to be positive and sum to one. In this case, the classic
thechnique is to use a logit-like transformation: for example:
<hansl>
nulldata 10000
x1 = normal()
x2 = normal()
x3 = normal()
y = 0.5 * x1 + 0.2 * x2 + 0.3 * x3 + normal()
b1 = 0
b2 = 0
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
params b1 b2
end nls
printf "w1 = %f, w2 = %f\n", w1, w2
</hansl>
Or have I misunderstood your point?
-------------------------------------------------------
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
-------------------------------------------------------