___ ____ ____ ____ ____ ® /__ / ____/ / ____/ 18.0 ___/ / /___/ / /___/ SE—Standard Edition Statistics and Data Science Copyright 1985-2023 StataCorp LLC StataCorp 4905 Lakeway Drive College Station, Texas 77845 USA 800-STATA-PC https://www.stata.com 979-696-4600 stata@stata.com Stata license: 10-user network perpetual Serial number: 1 Licensed to: Stata Developer StataCorp LLC Notes: 1. Stata is running in batch mode. 2. Unicode is supported; see help unicode_advice. 3. Maximum number of variables is set to 5,000 but can be increased; see help set_maxvar. Running /home/krg/bin/profile.do ... Compile number 180110 . do hahn1.do . /* NIST/ITL StRD > > Nonlinear Regression > > Difficulty=Average Rational k=7 N=236 Observed > > Dataset Name: Hahn1 (Hahn1.dat) > > Procedure: Nonlinear Least Squares Regression > > Description: These data are the result of a NIST study involving > the thermal expansion of copper. The response > variable is the coefficient of thermal expansion, and > the predictor variable is temperature in degrees > kelvin. > > > Reference: Hahn, T., NIST (197?). > Copper Thermal Expansion Study. > > Data: 1 Response (y = coefficient of thermal expansion) > 1 Predictor (x = temperature, degrees kelvin) > 236 Observations > Average Level of Difficulty > Observed Data > > Model: Rational Class (cubic/cubic) > 7 Parameters (b1 to b7) > > y = (b1+b2*x+b3*x**2+b4*x**3) / > (1+b5*x+b6*x**2+b7*x**3) + e > > > Starting values Certified Values > > Start 1 Start 2 Parameter Standard Deviation > b1 = 10 1 1.0776351733E+00 1.7070154742E-01 > b2 = -1 -0.1 -1.2269296921E-01 1.2000289189E-02 > b3 = 0.05 0.005 4.0863750610E-03 2.2508314937E-04 > b4 = -0.00001 -0.000001 -1.4262662514E-06 2.7578037666E-07 > b5 = -0.05 -0.005 -5.7609940901E-03 2.4712888219E-04 > b6 = 0.001 0.0001 2.4053735503E-04 1.0449373768E-05 > b7 = -0.000001 -0.0000001 -1.2314450199E-07 1.3027335327E-08 > > Residual Sum of Squares: 1.5324382854E+00 > Residual Standard Deviation: 8.1803852243E-02 > Degrees of Freedom: 229 > Number of Observations: 236 > */ . . clear . . scalar N = 236 . scalar df_r = 229 . scalar df_m = 7 . . scalar rss = 1.5324382854E+00 . scalar rmse = 8.1803852243E-02 . . scalar b1 = 1.0776351733E+00 . scalar seb1 = 1.7070154742E-01 . scalar b2 = -1.2269296921E-01 . scalar seb2 = 1.2000289189E-02 . scalar b3 = 4.0863750610E-03 . scalar seb3 = 2.2508314937E-04 . scalar b4 = -1.4262662514E-06 . scalar seb4 = 2.7578037666E-07 . scalar b5 = -5.7609940901E-03 . scalar seb5 = 2.4712888219E-04 . scalar b6 = 2.4053735503E-04 . scalar seb6 = 1.0449373768E-05 . scalar b7 = -1.2314450199E-07 . scalar seb7 = 1.3027335327E-08 . . qui input double (y x) . . #delimit ; delimiter now ; . nl (y = ({b1} + {b2}*x + {b3}*x^2 + {b4}*x^3) / > (1 + {b5}*x + {b6}*x^2 + {b7}*x^3) ) , > initial(b1 10 b2 -1 b3 0.05 b4 -0.00001 b5 -0.05 b6 0.001 b7 -0.000001) > eps(1e-10) ; Iteration 0: Residual SS = 82100.05 Iteration 1: Residual SS = 8813.617 Iteration 2: Residual SS = 1142.476 Iteration 3: Residual SS = 25.20977 Iteration 4: Residual SS = 10.48817 Iteration 5: Residual SS = 1.903717 Iteration 6: Residual SS = 1.534958 Iteration 7: Residual SS = 1.532439 Iteration 8: Residual SS = 1.532438 Iteration 9: Residual SS = 1.532438 Iteration 10: Residual SS = 1.532438 Iteration 11: Residual SS = 1.532438 Iteration 12: Residual SS = 1.532438 Source | SS df MS -------------+---------------------------------- Number of obs = 236 Model | 55508.356 7 7929.76516 R-squared = 1.0000 Residual | 1.5324383 229 .00669187 Adj R-squared = 1.0000 -------------+---------------------------------- Root MSE = .0818039 Total | 55509.889 236 235.211392 Res. dev. = -518.9863 ------------------------------------------------------------------------------ y | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- /b1 | 1.077635 .1707016 6.31 0.000 .7412886 1.413982 /b2 | -.122693 .0120003 -10.22 0.000 -.1463381 -.0990479 /b3 | .0040864 .0002251 18.15 0.000 .0036429 .0045299 /b4 | -1.43e-06 2.76e-07 -5.17 0.000 -1.97e-06 -8.83e-07 /b5 | -.005761 .0002471 -23.31 0.000 -.0062479 -.0052741 /b6 | .0002405 .0000104 23.02 0.000 .0002199 .0002611 /b7 | -1.23e-07 1.30e-08 -9.45 0.000 -1.49e-07 -9.75e-08 ------------------------------------------------------------------------------ . #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 () /* > */ [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 () /* > */ e(rmse) rmse e(rss) rss [b1]_b[_cons] 7.4 [b2]_b[_cons] 7.5 [b3]_b[_cons] 7.8 [b4]_b[_cons] 7.1 [b5]_b[_cons] 8.2 [b6]_b[_cons] 7.9 [b7]_b[_cons] 7.4 ------------------------- min 7.1 [b1]_se[_cons] 6.4 [b2]_se[_cons] 6.3 [b3]_se[_cons] 6.1 [b4]_se[_cons] 5.2 [b5]_se[_cons] 6.6 [b6]_se[_cons] 5.9 [b7]_se[_cons] 5.1 ------------------------- min 5.1 e(rmse) 11.5 e(rss) 10.6 . end of do-file