Hi,
I am running the following program using the NL command. I have been
able to restrict my parameters (A-J) to be positive by taking the square
root in the series of equations below. Additionally, I would like to
restrict the parameter H below to be less than 1. I am not sure how one
does this here, any thoughts would be helpful.
Thanks,
Randy
capture program drop nlmin
program nlmin
syntax varlist(min =1 max=15) [if], at(name)
tempname A B C D E F G H I J
scalar `A' = `at'[1,1]
scalar `B' = `at'[1,2]
scalar `C' = `at'[1,3]
scalar `D' = `at'[1,4]
scalar `E' = `at'[1,5]
scalar `F' = `at'[1,6]
scalar `G' = `at'[1,7]
scalar `H' = `at'[1,8]
scalar `I' = `at'[1,9]
scalar `J' = `at'[1,10]
tempvar yh
gen double `yh' = (`A'^2) + (`B'^2) + (`C'^2)+1 - x93 in 1
replace `yh' = (`A'^2) + (`C'^2) + (`D'^2) - x92 in 2
replace `yh' = (`A'^2) + (`D'^2) + (`E'^2) - x91 in 3
replace `yh' = (`A'^2) + (`E'^2) + (`F'^2) - x90 in 4
replace `yh' = (`A'^2) + (`F'^2) + (`G'^2) - x89 in 5
replace `yh' = (`H'^2)*(`B'^2) + (`I'^2) + (`J'^2) - xdiff in 6
replace `yh' = -(`C'^2) - x93 in 7
replace `yh' = -(`D'^2) - x92 in 8
replace `yh' = -(`E'^2) - x91 in 9
replace `yh' = -(`F'^2) - x90 in 10
replace `yh' = `H'*(`B'^2) - x93_diff in 11
replace `varlist' = `yh'
end
clear
set obs 11
gen x93 = 0.098
gen x92 = 0.08
gen x91 = 0.1092
gen x90 = 0.1639
gen x89 = 0.1806
gen xdiff = 0.4009
gen x93 = 0.398
gen x92 = -0.011
gen x91 = -0.022
gen x90 = -0.047
gen x93_diff = -0.046
gen y =0
replace y =1 in 1
nl min @ y, parameters (A B C D E F G H I J) init(A 0.5 B 0.5 C 0.5 D
0.5 E 0.5 F 0.5 G 0.5 H 0.5 I 0.5 J 0.5)
-------------------------------------------------
Randall K. Q. Akee, Ph.D.
Research Associate
IZA - Forschungsinstitut zur Zukunft der Arbeit GmbH
IZA - Institute for the Study of Labor
P.O. Box 7240, 53072 Bonn, Germany
Schaumburg-Lippe-Str. 5-9, 53113 Bonn, Germany
Phone: +49 (228) 3894-306; Fax: +49 (228) 3894-510
E-Mail: [email protected]
Web: http://www.iza.org
Registered Office Bonn, District Court of Bonn, HRB 7745
Represented by: Prof. Dr. Klaus F. Zimmermann (Director)
-------------------------------------------------
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/