I would like to evaluate the following function using non-linear least squares using Stata:
I am testing the results of another papper and would like to use Stata as it is the same software / solver as they are used in the document that I am replicating and because it should be easier than using GAMS, for example.
My problem is that I canβt find a way to write the total part of the equation above. In my data, all I have is one observation with values ββfor j in separate variables. I could write the whole expression as follows (for three observations / i):
nl (ln_wage = {alpha0} + {alpha0}*log( ((S_over_H_1)^{alpha2})*exp({alpha3}*distance_1) + ((S_over_H_2)^{alpha2})*exp({alpha3}*distance_2) + ((S_over_H_1)^{alpha2})*exp({alpha3}*distance_1) ))
Is there an easy way to tell Stata about summing expressions / variables for a given set of numbers, like in GAMS, where you can write:
lnwage(i) = alpha0 + alpha1*ln(sum((j), power(S_over_H(i,j),alpha2) * exp(alpha3 * distance(i,j))))
Jens source share