# multiple linear regression fit # # example from # John Heilborn, Ed. 1981 "Science and engineering programs, Apple II Edition" Osborn/McGraw Hill p10 of 227pp ISBN 0-9310-63-2 # xData := 71 73 64 65 61 70 65 72 63 67 64 % height (in) ; # yData := 160 183 154 168 159 180 145 210 132 168 141 % weight (#) ; # fit_linearRegressSingle xData yData "pass "pass (link d_temp 'fit_linearRegressSingle Heilborn example.txt') # book result : f(x) = constant + slope * x # constant slope coeffDeterm(=R^2) coeffCorrel(=R) StdErrEst # -106.7917 4.047223 0.556260 0.745828 15.413488 # standard result : # "$d_Qtest"'fit_linearRegress/fit_linearRegress - tests SLR_Heilborn standard.txt' Coefficients & statistics : +------------------+--------+ |constant |-85.3417| +------------------+--------+ |slope | 3.74389| +------------------+--------+ |coeffDeterm_Rsq |0.305514| +------------------+--------+ |CorrCoeff^2 |0.552733| +------------------+--------+ |StndErrOf estimate| 14.3604| +------------------+--------+ # # for regression tables etc, copy-paste to LibreCalc : # geany Replace spaces with tab : search : \s+ replace : \t # multLinReg estimates and residuals +--+------+----+-------+----------+---------+ |i |xGiven|yObs|yEst |yResiduals|pct_resid| +--+------+----+-------+----------+---------+ |0 | 71| 160|180.474| -20.4744| -12.7965| +--+------+----+-------+----------+---------+ |1 | 73| 183|187.962| -4.96222| -2.7116| +--+------+----+-------+----------+---------+ |2 | 64| 154|154.267| -0.267222|-0.173521| +--+------+----+-------+----------+---------+ |3 | 65| 168|158.011| 9.98889| 5.94577| +--+------+----+-------+----------+---------+ |4 | 61| 159|143.036| 15.9644| 10.0405| +--+------+----+-------+----------+---------+ |5 | 70| 180|176.731| 3.26944| 1.81636| +--+------+----+-------+----------+---------+ |6 | 65| 145|158.011| -13.0111| -8.97318| +--+------+----+-------+----------+---------+ |7 | 72| 210|184.218| 25.7817| 12.277| +--+------+----+-------+----------+---------+ |8 | 63| 145|150.523| -5.52333| -3.8092| +--+------+----+-------+----------+---------+ |9 | 67| 168|165.499| 2.50111| 1.48876| +--+------+----+-------+----------+---------+ |10| 64| 141|154.267| -13.2672| -9.40938| +--+------+----+-------+----------+---------+