___ ____ ____ ____ ____ © /__ / ____/ / ____/ 17.0 ___/ / /___/ / /___/ SE—Standard Edition Statistics and Data Science Copyright 1985-2021 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; see help set_maxvar. Running /home/krg/bin/profile.do ... Compile number 170082 . do boxbod.do . /* NIST/ITL StRD > Dataset Name: BoxBOD (BoxBOD.dat) > > File Format: ASCII > Starting Values (lines 41 to 42) > Certified Values (lines 41 to 47) > Data (lines 61 to 66) > > Procedure: Nonlinear Least Squares Regression > > Description: These data are described in detail in Box, Hunter and > Hunter (1978). The response variable is biochemical > oxygen demand (BOD) in mg/l, and the predictor > variable is incubation time in days. > > > Reference: Box, G. P., W. G. Hunter, and J. S. Hunter (1978). > Statistics for Experimenters. > New York, NY: Wiley, pp. 483-487. > > > > > > Data: 1 Response (y = biochemical oxygen demand) > 1 Predictor (x = incubation time) > 6 Observations > Higher Level of Difficulty > Observed Data > > Model: Exponential Class > 2 Parameters (b1 and b2) > > y = b1*(1-exp[-b2*x]) + e > > > > Starting values Certified Values > > Start 1 Start 2 Parameter Standard Deviation > b1 = 1 100 2.1380940889E+02 1.2354515176E+01 > b2 = 1 0.75 5.4723748542E-01 1.0455993237E-01 > > Residual Sum of Squares: 1.1680088766E+03 > Residual Standard Deviation: 1.7088072423E+01 > Degrees of Freedom: 4 > Number of Observations: 6 > */ . . clear . . scalar N = 6 . scalar df_r = 4 . scalar df_m = 2 . . scalar rss = 1.1680088766E+03 . scalar rmse = 1.7088072423E+01 . . scalar b1 = 2.1380940889E+02 . scalar seb1 = 1.2354515176E+01 . scalar b2 = 5.4723748542E-01 . scalar seb2 = 1.0455993237E-01 . . qui input double(y x) . . nl ( y = {b1}*(1-exp(-{b2}*x)) ), init(b1 1 b2 1) eps(1e-10) (obs = 6) Iteration 0: residual SS = 184700 Iteration 1: residual SS = 13388.66 Iteration 2: residual SS = 7327.64 Iteration 3: residual SS = 2375.331 Iteration 4: residual SS = 1388.389 Iteration 5: residual SS = 1168.01 Iteration 6: residual SS = 1168.009 Iteration 7: residual SS = 1168.009 Iteration 8: residual SS = 1168.009 Iteration 9: residual SS = 1168.009 Iteration 10: residual SS = 1168.009 Iteration 11: residual SS = 1168.009 Iteration 12: residual SS = 1168.009 Iteration 13: residual SS = 1168.009 Iteration 14: residual SS = 1168.009 Iteration 15: residual SS = 1168.009 Source | SS df MS -------------+---------------------------------- Number of obs = 6 Model | 187140.99 2 93570.4956 R-squared = 0.9938 Residual | 1168.0089 4 292.002219 Adj R-squared = 0.9907 -------------+---------------------------------- Root MSE = 17.08807 Total | 188309 6 31384.8333 Res. dev. = 48.65504 ------------------------------------------------------------------------------ y | Coefficient Std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- /b1 | 213.8094 12.35451 17.31 0.000 179.5078 248.111 /b2 | .5472375 .10456 5.23 0.006 .2569325 .8375425 ------------------------------------------------------------------------------ . . 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 () /* > */ [b1]_se[_cons] seb1 [b2]_se[_cons] seb2 () /* > */ e(rmse) rmse e(rss) rss [b1]_b[_cons] 7.9 [b2]_b[_cons] 7.3 ------------------------- min 7.3 [b1]_se[_cons] 6.8 [b2]_se[_cons] 6.7 ------------------------- min 6.7 e(rmse) 11.1 e(rss) 10.4 . . end of do-file