I am trying to estimate the parameters a and c of a nonlinear equation. The nonlinear equation is: y=a*(x/10)^(c-1). The code that I use is the following:
Code:
program nlces
version 17
syntax varlist(min=2 max=2) [if], at(name)
local y: word 1 of `varlist'
local x: word 2 of `varlist'
// Retrieve parameters out of at
tempname a c
scalar `a' = `at'[1,1]
scalar `c' = `at'[1,2]
// Some temporary variables
tempvar dterm
generate double `dterm' = (`x'/10)^(`c'-1) `if'
// Now fill in dependent variable
replace `y' = `a'*`dterm' `if'
end
//Call nl like this, specifying initial values for some or all of the parameters:
nl ces @ y x, parameters(a c) initial(a 0.0001 c 1)Thank you very much for your help!
0 Response to My nl equation has an error, please help!
Post a Comment