___ ____ ____ ____ ____ (R) /__ / ____/ / ____/ ___/ / /___/ / /___/ 14.0 Copyright 1985-2015 StataCorp LP Statistics/Data Analysis StataCorp 4905 Lakeway Drive Special Edition College Station, Texas 77845 USA 800-STATA-PC http://www.stata.com 979-696-4600 stata@stata.com 979-696-4601 (fax) 10-user Stata network perpetual license: Serial number: 1 Licensed to: Stata Developer StataCorp LP Notes: 1. Stata is running in batch mode. 2. Unicode is supported; see help unicode_advice. 3. Maximum number of variables is set to 5000; see help set_maxvar. . do gauss2.do . /* NIST StRD benchmark from http://www.nist.gov/itl/div898/strd/ > > Nonlinear Regression > > Difficulty=Lower Exponential k=8 N=250 Generated > > Dataset Name: Gauss2 (Gauss2.dat) > > Procedure: Nonlinear Least Squares Regression > > Description: The data are two slightly-blended Gaussians on a > decaying exponential baseline plus normally > distributed zero-mean noise with variance = 6.25. > > Reference: Rust, B., NIST (1996). > > Data: 1 Response (y) > 1 Predictor (x) > 250 Observations > Lower Level of Difficulty > Generated Data > > Model: Exponential Class > 8 Parameters (b1 to b8) > > y = b1*exp( -b2*x ) + b3*exp( -(x-b4)**2 / b5**2 ) > + b6*exp( -(x-b7)**2 / b8**2 ) + e > > > Starting values Certified Values > > Start 1 Start 2 Parameter Standard Deviation > b1 = 96.0 98.0 9.9018328406E+01 5.3748766879E-01 > b2 = 0.009 0.0105 1.0994945399E-02 1.3335306766E-04 > b3 = 103.0 103.0 1.0188022528E+02 5.9217315772E-01 > b4 = 106.0 105.0 1.0703095519E+02 1.5006798316E-01 > b5 = 18.0 20.0 2.3578584029E+01 2.2695595067E-01 > b6 = 72.0 73.0 7.2045589471E+01 6.1721965884E-01 > b7 = 151.0 150.0 1.5327010194E+02 1.9466674341E-01 > b8 = 18.0 20.0 1.9525972636E+01 2.6416549393E-01 > > Residual Sum of Squares: 1.2475282092E+03 > Residual Standard Deviation: 2.2704790782E+00 > Degrees of Freedom: 242 > Number of Observations: 250 > */ . . clear . . scalar N = 250 . scalar df_r = 242 . scalar df_m = 8 . . scalar rss = 1.2475282092E+03 . scalar rmse = 2.2704790782E+00 . . scalar b1 = 9.9018328406E+01 . scalar seb1 = 5.3748766879E-01 . scalar b2 = 1.0994945399E-02 . scalar seb2 = 1.3335306766E-04 . scalar b3 = 1.0188022528E+02 . scalar seb3 = 5.9217315772E-01 . scalar b4 = 1.0703095519E+02 . scalar seb4 = 1.5006798316E-01 . scalar b5 = 2.3578584029E+01 . scalar seb5 = 2.2695595067E-01 . scalar b6 = 7.2045589471E+01 . scalar seb6 = 6.1721965884E-01 . scalar b7 = 1.5327010194E+02 . scalar seb7 = 1.9466674341E-01 . scalar b8 = 1.9525972636E+01 . scalar seb8 = 2.6416549393E-01 . . qui input double (y x) . . #delimit ; delimiter now ; . nl ( y = {b1}*exp( -{b2}*x ) + {b3}*exp( -(x-{b4})^2 / {b5}^2 ) > + {b6}*exp( -(x-{b7})^2 / {b8}^2 ) ), > init(b1 96 b2 0.009 b3 103 b4 106 b5 18 b6 72 b7 151 b8 18) > eps(1e-10) ; (obs = 250) Iteration 0: residual SS = 1613.56 Iteration 1: residual SS = 1248.662 Iteration 2: residual SS = 1247.528 Iteration 3: residual SS = 1247.528 Iteration 4: residual SS = 1247.528 Iteration 5: residual SS = 1247.528 Iteration 6: residual SS = 1247.528 Iteration 7: residual SS = 1247.528 Source | SS df MS -------------+---------------------------------- Number of obs = 250 Model | 1269850.5 8 158731.307 R-squared = 0.9990 Residual | 1247.5282 242 5.15507524 Adj R-squared = 0.9990 -------------+---------------------------------- Root MSE = 2.270479 Total | 1271098 250 5084.39194 Res. dev. = 1111.334 ------------------------------------------------------------------------------ y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- /b1 | 99.01833 .5374877 184.22 0.000 97.95958 100.0771 /b2 | .0109949 .0001334 82.45 0.000 .0107323 .0112576 /b3 | 101.8802 .592173 172.04 0.000 100.7138 103.0467 /b4 | 107.031 .150068 713.22 0.000 106.7353 107.3266 /b5 | 23.57858 .2269559 103.89 0.000 23.13152 24.02565 /b6 | 72.04559 .6172196 116.73 0.000 70.82978 73.2614 /b7 | 153.2701 .1946668 787.35 0.000 152.8866 153.6536 /b8 | 19.52597 .2641658 73.92 0.000 19.00561 20.04633 ------------------------------------------------------------------------------ . #delimit cr delimiter now cr . . assert N == e(N) . assert df_r == e(df_r) . assert df_m == e(df_m) . . lrecomp [b1]_b[_cons] b1 [b2]_b[_cons] b2 [b3]_b[_cons] b3 /* > */ [b4]_b[_cons] b4 [b5]_b[_cons] b5 [b6]_b[_cons] b6 /* > */ [b7]_b[_cons] b7 [b8]_b[_cons] b8 () /* > */ [b1]_se[_cons] seb1 [b2]_se[_cons] seb2 [b3]_se[_cons] seb3 /* > */ [b4]_se[_cons] seb4 [b5]_se[_cons] seb5 [b6]_se[_cons] seb6 /* > */ [b7]_se[_cons] seb7 [b8]_se[_cons] seb8 () /* > */ e(rmse) rmse e(rss) rss [b1]_b[_cons] 9.5 [b2]_b[_cons] 9.9 [b3]_b[_cons] 9.2 [b4]_b[_cons] 9.4 [b5]_b[_cons] 8.4 [b6]_b[_cons] 9.6 [b7]_b[_cons] 9.4 [b8]_b[_cons] 8.2 ------------------------- min 8.2 [b1]_se[_cons] 6.9 [b2]_se[_cons] 6.3 [b3]_se[_cons] 6.5 [b4]_se[_cons] 6.8 [b5]_se[_cons] 6.4 [b6]_se[_cons] 6.8 [b7]_se[_cons] 6.9 [b8]_se[_cons] 5.9 ------------------------- min 5.9 e(rmse) 10.7 e(rss) 10.6 . end of do-file