Sie sind auf Seite 1von 25

Each tab of this spreadsheet describes a function

Look along the bottom row. The tabs there -- LSFit, LSFit Y Uncertainty, etc. -- each introduce a useful
set of routines.
Just click on a tab to go to that section, or use these links:
How to View the Visual Basic for Applications Source Code for These Functions
How to Use an Array Function
How to Goal Seek
How to Use LSFit to find an Unweighted Least Squares Fit
How to Use LSFit to find Weighted Least Squares Fit
How to Use LSFitBoth to find an Weighted Least Squares Fit, with Errors in X and Y
About this program
To View the source code for the functions in this spreadsheet,
Run Tools/Macro/Visual Basic Editor
You may not have installed the VB editor when you installed Excel.
If not, you can just run Office setup to add it in.
Make sure the Project Explorer is open with View/Project Explorer
The function is in "VBAProject (LeastSquares.xls) / Modules / LeastSquares"
Many of these functions are "Array Functions"
Some of the functions are excel array functions, which you might not be familiar with.
An array function takes one or several values and returns an array --
several values in a particular 2-D order.
An example of a built-in array function is LINEST, the excel function to find linear fits.
Also see the Excel help topic, "About array formulas and how to enter them."
To enter an array formula,
Select a range of cells with the shape of the array the function returns.
For example, the LSFit function returns a 2 column by 4 row array.
You don't have to use the full size. For instance, if you only want the slope and uncertainty,
just choose a 2 column by 1 row set of cells. If you choose too many cells they
will be filled with "#N/A!" but otherwise the function will still work correctly.
Type your formula into the formula entry box at the top of the screen.
For instance, if you wanted to run LSFit on data in cells E10:E15 and G10:G15,
you would type in "=LSFit(E10:E15, G10:G15)" without the quotes.
Then hit "Control-Shift-Enter" your range should be filled with least squares fit goodness
For instance, if you run LSFit, your result will be in the form
Slope Intercept
Uncertainty in Slope Uncertainty in Intercept
Pearson's R
2
Value Standard Error in Y
Regression Sum of Squares Residuals Sum of Squares
If, on the other hand, you used LSFitBoth, your result would appear as
Slope Intercept
Uncertainty in Slope Uncertainty in Intercept
Minimize This Residuals Sum of Squares
You don't have to use the array functions, though.
For LSFit, there are non-array functions which directly return each of the above values.
Take note though: each requires a separate call to the main (LSFit or LSFitBoth, etc.) function.
Therefore, to get all eight of the values listed above would be eight times as slow as
using the array formula would be. It will also take longer to type in.
However, in practice, you will not notice the speed difference. Only if you are iterating on
a large array should this be a factor. Feel free to use the non-array versions of these commands.
For LSFitBoth, you must either use the array function or you may use the INDEX function
to extract the desired value. For instance, to find the Uncertainty in the Slope for LSBoth, use
=INDEX(LSFitBoth(A10:A20, B10:B20, C10:C20, D10:D20, A5),2, 1)
About this program
These routines were written by Philip Kromer for the UT-Austin Modern Physics Lab (Hook 'em Horns).
http://www.ph.utexas.edu/~phy453/
This work was partially supported by a grant from National Instruments.
http://www.natinst.com/
These routines distributed under the GPL. Read more at
http://www.gnu.org/licenses/gpl.html
You may use this code, without charge, for as long as you want.
You may use this code for any application, commercial or not.
However, you must ensure that however the code is distributed, the
source code to these modules remains visible and editable.
You must also ensure that I (Philip Kromer) receive credit for this functionality, and that any
person who views the source code will also see these restrictions.
You may not charge for this code, although you may use it in a commercal
product as long as there is significant additional functionality.
If you make an interesting modification to this code, please let me know!
Philip Kromer <flip@mrflip.com>
For a pretty spreadsheet which documents and provides examples, go see
http://mrflip.com/resources/ExcelFunctions/
Copyright Philip Kromer, 1999
Look along the bottom row. The tabs there -- LSFit, LSFit Y Uncertainty, etc. -- each introduce a useful
Take note though: each requires a separate call to the main (LSFit or LSFitBoth, etc.) function.
a large array should this be a factor. Feel free to use the non-array versions of these commands.
These routines were written by Philip Kromer for the UT-Austin Modern Physics Lab (Hook 'em Horns).
Function LSFit
Does a simple least-squares fit on a set of data.
Notice that the arguments are LSFit(X, Y)
This is the opposite of the order of the Excel commands Slope, Intercept, and LinEst!
Also, we do not compute the F value so the output does not match up exactly either.
To Run the Function
Make two arrays of numbers -- an X and a Y
Run "{=LSFit(B41:B50, C41:C50)}"
An Example Array:
Slope -5
Intercept 20
Nonlinearity 0%
Noise 10%
X Y
1 13.61
2 10.71
3 5.19
4 0.00
5 -5.19
6 -10.71
7 -13.62
8 -20.00
9 -27.31
10 -27.89
The Results:
Using LSFit as an Array Function
Slope Intercept
Value -4.92 19.54
Uncertainty 0.15 0.91
R / Sy 0.99 1.33
SSreg / SSres 1998 14.2
Using LSFitSlope, LSFitIntercept, etc.
Slope Intercept
Value -4.92 19.54
Uncertainty 0.15 0.91
R / Sy 0.99 1.33
SSreg / SSres 1998 14.2
Using Built in Excel Functions
Slope Intercept
Value -4.921 19.545
-40.00
-30.00
-20.00
-10.00
0.00
10.00
20.00
30.00
0 2 4
Y

Uncertainty 0.147 0.910
R / Sy 0.993 1.3
F / dF 1124.7 8.0
SSreg / SSres 1997.6 14.2
This is the opposite of the order of the Excel commands Slope, Intercept, and LinEst!
Also, we do not compute the F value so the output does not match up exactly either.
4 6 8 10
X
Function LSFit -- With Uncertainties (Weighted Fit)
Does a simple least-squares fit on a set of data.
The arguments are LSFit(X, Y, Yerr)
Notice that this is the opposite of the order of the Excel commands Slope, Intercept, and LinEst!
Also, we do not compute the F value so the output does not match up exactly either.
To Run the Function
Make two arrays of numbers -- an X and a Y
Run "{=LSFit(B41:B50, C41:C50)}"
An Example Array:
Slope 4
Intercept 25
Nonlinearity 30%
Noise 10%
Uncertainty 40%
X Y Y Uncertainty
1 27.41 11.44
2 40.47 14.95
3 49.63 21.79
4 54.18 19.56
5 77.86 33.66
6 98.73 37.64
7 101.48 40.81
8 133.77 55.56
9 172.83 64.03
10 171.96 75.37
The Results:
Using LSFit as an Array Function
Slope Intercept
Value 14.02 10.72
Uncertainty 1.24 4.14
R / Sy 0.94 0.35
SSreg / SSres 16 1.0 X
0
Using LSFitSlope, LSFitIntercept, etc. 1
Slope Intercept 2
0
50
100
150
200
0 2
Y

Y
Weighted Fit Y
Excel's Fit Y
Note that the unweighted fit pays too much attention to the (poorer quality) points on the left
side of the graph. The weighted fit hews more closely to the points with small uncertainties,
and is appropriately disdainful of the points with large error bars. The difference is especially
obvious in a curve with high scatter and large error bars.
Value 14.02 10.72 3
Uncertainty 1.24 4.14 4
R / Sy 0.94 0.35 5
SSreg / SSres 16 1.0 6
7
Using Built in Functions (which don't know about uncertainty!) 8
Slope Intercept 9
Value 17.04 -0.86 10
Uncertainty 1.30 8.04
R / Sy 0.96 11.78
F / dF 173 8.0
SSreg / SSres 23943 1109
Using Mathematica (does Uncertainty right)
Slope Intercept
Value 14.02 10.72
Uncertainty 1.24 4.14
R / Sy 0.94
SSreg / SSres 16 1.0 This Cell should say "Null":
This Cell should say 1:
Note: the box on left was computed using Mathematica
comparison only none of the other commands require this package.
If you have the Mathematica/Excel link, evaluate the pink cell below and then the
cells at left.
Weighted Fit Y Excel's Fit Y
11 -1
25 16
39 33
4 6 8 10
X
Y
Weighted Fit Y
Excel's Fit Y
Note that the unweighted fit pays too much attention to the (poorer quality) points on the left
side of the graph. The weighted fit hews more closely to the points with small uncertainties,
and is appropriately disdainful of the points with large error bars. The difference is especially
obvious in a curve with high scatter and large error bars.
53 50
67 67
81 84
95 101
109 118
123 135
137 152
151 169
This Cell should say "Null": Null
This Cell should say 1: 1
Note: the box on left was computed using Mathematica-Excel Link; it is for
comparison only none of the other commands require this package.
If you have the Mathematica/Excel link, evaluate the pink cell below and then the
Function LSFitBoth -- Goal Seeking Method For Weighted Fits With Uncertainties in Both Coordinates
LSFitBoth can do a weighted least-squares fit on a set of data with uncertainty in X and Y.
The arguments are LSFitBoth(X, Y, Xerr, Yerr, Slope)
The weight for each point is one over its uncertainty squared. This is usually the right thing.
This function does not actually determine the slope. Instead, it returns a value -- Minimize this -- which the Tools / Goal Seek command
can use to find the true slope. Just have Excel goal seek the Minimize this result to be zero, based on the slope seed which you provide.
The resulting slope -- after goal seeking -- is either completely right or completely wrong. That is, it will converge to the best or to the worst fit.
If it goes to the worst fit (obvious upon graphing the result), simply start goal seek with a different initial slope. Elementary geometry suggests that
the opposite inverse -- (-1/m) -- is a good value in that case.
This technique is based on the paper "Linear least-squares fits with errors in both coordinates," Am. J. Phys 57 #7 p. 642 (1989) By B.C. Reed.
The algorithm ws first developed by York, Can. J. Phys. 44 (1966) p.1079 : "Least Squares Fitting with Errors in Both Coordinates."
If you are really going to look these papers up, also see the erratum in Am. J. Phys 58 #2 p.189 (1990)
To Run the Function
Make four columns of numbers containing X and Y data, and their uncertainties.
Make another cell and initialize it with a seed for the slope of the data. SLOPE or LSFit can suggest a value.
Make another cell with the formula "=LSFitBothMinimizeThis($C$65:$C$74,$D$65:$D$74,$E$65:$E$74,$F$65:$F$74,$J$93)"
Of course, you should leave off the quotes and use the ranges for the four columns followed by the slope seed.
Run Tools / Goal Seek menu function; you would like to seek the MinimizeThis cell to be zero (0) by changing the slope seed cell.
The resulating value of the slope seed is the slope of the fit.
For the full information, select a range that is two columns wide by up to three rows long.
Type " "=LSFitBoth($C$65:$C$74,$D$65:$D$74,$E$65:$E$74,$F$65:$F$74,$J$93)" into the top left cell of that range.
Hit Control-Shift-Enter.
The values returned by LSFitBoth are
Slope Intercept
Uncertainty in Slope Uncertainty in Intercept
Minimize This Residuals Sum of Squares
How to Goal Seek
There is no simple, general technique that gives a simple function for a fit to data when there are errors in both coordinates.
A rough and ready form is to graph X vs. Y, then Y vs. X, and to use the average of their fit values and the pythagorean sum of their uncertainties.
There are, however, pathological cases which will defeat this method.
Here we describe a technique which uses a quite powerful tool built into Excel, known as "Goal Seek."
Goal Seek lets you iterate a function until its output achieves a given value. It can find roots, maxima and minima, among other abilities.
For example, we know that Sin(x) has a maximum at p/4. We will demonstrate Goal Seek by finding a maximum of Sin(x).
Set up cells with the input to your function (in our case, x) and the function you want to calculate. (It may be arbitrarily complicated,
and it may depend on many cells and functions; They must all, however, depend on only one input variable -- otherwise you need to use the Solver add-in)
For instance, in the box for X below, type in "0.4;" the box for Sin(x) should read 0.389
X 0.400
Sin (X) 0.389
Now, on the Excel Menu, choose Tools / Goal Seek. Tell it to set cell E28 (or whatever) to value 1 by changing cell E27.
You should get the value for p/4: p/4 1.571
Instead, I think you will get the result 1.541. Below 1.541
Try it again, but start with x=2.0: Above 1.603
What happened? Well, we are looking for a maximum: by definition, the function is flat near such a point, so all output values look the same
near that value for x. This is an intrinsic problem for any such algortihm.
Notice, too, that although our input values are different, the output values are off by less than a thousandth part.
Fortunately, this is not usually a worry when we find roots (places where a function crosses zero) since, except for pathological cases,
the function will do so at a reasonably sharp angle. (Those pathological cases are easy to see by graphing the function).
Punch in an initial value for x of say 4.0, and goal seek sin(x) to be zero. You will get the familiar result 3.14159
X 4.00000
Sin (X) -0.757
As promised, Goal seek found the rood to a high degree of accuracy. Also note that if you start it near say 7 it will find 2p, etc
Goal Seek will generally find the "nearest" solution to your starting value. If you give it a sane starting point it will settle down correctly.
Some Example Data:
Slope 4
Intercept 25
Nonlinearity 18%
Noise 15%
Uncertainty 10%
X
i
Y
i
DX
i
DY
i
0 5.90 0.10 1.00
0.9 5.40 0.10 0.75
1.8 4.40 0.04 0.50
2.6 4.60 0.04 0.35
3.3 3.50 0.07 0.22
4.4 3.70 0.11 0.22
5.2 2.80 0.13 0.12
6.1 2.80 0.22 0.12
6.5 2.40 0.75 0.10
7.4 1.50 1.00 0.04
From York, Can. J. Phys. 44 (1966) 1079 : Least Squares Fitting
0
1
2
3
4
5
6
7
0 1
Y

Note that the unweighted fit pays too much attention to the (poorer quality) points on the left and right side of the graph.
The weighted fit hews more closely to the points with small uncertainties, and is appropriately disdainful of the points with
unfortunately misled by the points at the lower right -- which have large uncertainties in X and are not as trustowrthy as the n
The X & Y weighted fit laughs at the impostors on the left and right of the graph both the same, and finds a visibly truer fi
The technique for errors in both coordinates is necessary when there are points with large
The Results:
Using LSFitBoth
Slope Intercept
Slope / Intercept -0.48 5.48
Uncertainty 0.07 0.36
MinThis / SSRes 0.00046 11.87
alpha / beta -0.31 -0.24
gamma / delta 0.45 304.64
There is no LSFitBothSlope, LSFitBothIntercept, etc.
I figured it would clutter up the Function Wizard
Weighted in Y only
Slope Intercept
Slope / Intercept -0.61 6.10
Uncertainty 0.06 0.42
R / Sy 0.92 2.07
SSreg / SSres 412 34.3
Unweighted
Slope Intercept
Slope / Intercept -0.54 5.76
Uncertainty 0.04 0.19
R / Sy 0.95 0.32
SSreg / SSres 16 0.8
The last two rows of values are diagnostics; they are
not generally useful statistical values
Function LSFitBoth -- Goal Seeking Method For Weighted Fits With Uncertainties in Both Coordinates
LSFitBoth can do a weighted least-squares fit on a set of data with uncertainty in X and Y.
The weight for each point is one over its uncertainty squared. This is usually the right thing.
This function does not actually determine the slope. Instead, it returns a value -- Minimize this -- which the Tools / Goal Seek command
can use to find the true slope. Just have Excel goal seek the Minimize this result to be zero, based on the slope seed which you provide.
The resulting slope -- after goal seeking -- is either completely right or completely wrong. That is, it will converge to the best or to the worst fit.
If it goes to the worst fit (obvious upon graphing the result), simply start goal seek with a different initial slope. Elementary geometry suggests that
This technique is based on the paper "Linear least-squares fits with errors in both coordinates," Am. J. Phys 57 #7 p. 642 (1989) By B.C. Reed.
The algorithm ws first developed by York, Can. J. Phys. 44 (1966) p.1079 : "Least Squares Fitting with Errors in Both Coordinates."
If you are really going to look these papers up, also see the erratum in Am. J. Phys 58 #2 p.189 (1990)
Make another cell and initialize it with a seed for the slope of the data. SLOPE or LSFit can suggest a value.
Make another cell with the formula "=LSFitBothMinimizeThis($C$65:$C$74,$D$65:$D$74,$E$65:$E$74,$F$65:$F$74,$J$93)"
Of course, you should leave off the quotes and use the ranges for the four columns followed by the slope seed.
Run Tools / Goal Seek menu function; you would like to seek the MinimizeThis cell to be zero (0) by changing the slope seed cell.
For the full information, select a range that is two columns wide by up to three rows long.
Type " "=LSFitBoth($C$65:$C$74,$D$65:$D$74,$E$65:$E$74,$F$65:$F$74,$J$93)" into the top left cell of that range.
There is no simple, general technique that gives a simple function for a fit to data when there are errors in both coordinates.
A rough and ready form is to graph X vs. Y, then Y vs. X, and to use the average of their fit values and the pythagorean sum of their uncertainties.
Here we describe a technique which uses a quite powerful tool built into Excel, known as "Goal Seek."
Goal Seek lets you iterate a function until its output achieves a given value. It can find roots, maxima and minima, among other abilities.
For example, we know that Sin(x) has a maximum at p/4. We will demonstrate Goal Seek by finding a maximum of Sin(x).
Set up cells with the input to your function (in our case, x) and the function you want to calculate. (It may be arbitrarily complicated,
and it may depend on many cells and functions; They must all, however, depend on only one input variable -- otherwise you need to use the Solver add-in)
Now, on the Excel Menu, choose Tools / Goal Seek. Tell it to set cell E28 (or whatever) to value 1 by changing cell E27.
1.000 0.00000
1.000 0.00044
0.999 0.00052
What happened? Well, we are looking for a maximum: by definition, the function is flat near such a point, so all output values look the same
Notice, too, that although our input values are different, the output values are off by less than a thousandth part.
Fortunately, this is not usually a worry when we find roots (places where a function crosses zero) since, except for pathological cases,
the function will do so at a reasonably sharp angle. (Those pathological cases are easy to see by graphing the function).
Punch in an initial value for x of say 4.0, and goal seek sin(x) to be zero. You will get the familiar result 3.14159
As promised, Goal seek found the rood to a high degree of accuracy. Also note that if you start it near say 7 it will find 2p, etc
Goal Seek will generally find the "nearest" solution to your starting value. If you give it a sane starting point it will settle down correctly.
1 2 3 4 5 6 7 8
X
Yi
Unweighted
Weighted in Y
Weighted in X & Y
Note that the unweighted fit pays too much attention to the (poorer quality) points on the left and right side of the graph.
The weighted fit hews more closely to the points with small uncertainties, and is appropriately disdainful of the points with large error bars, but is
which have large uncertainties in X and are not as trustowrthy as the naive algorithm thinks.
The X & Y weighted fit laughs at the impostors on the left and right of the graph both the same, and finds a visibly truer fit.
The technique for errors in both coordinates is necessary when there are points with large X but small Y uncertainty, and vice versa.
Goal Seek this cell 0.00 to be Zero
Based on this cell -0.48096
A good initial value is -0.61
X
Weighted
in X & Y
Weighted
in Y Unweighted
-0.9 5.9 6.6 6.2
0 5.5 6.1 5.8
0.9 5.0 5.6 5.3
1.8 4.6 5.0 4.8
2.6 4.2 4.5 4.4
3.3 3.9 4.1 4.0
4.4 3.4 3.4 3.4
5.2 3.0 2.9 3.0
6.1 2.5 2.4 2.5
6.5 2.4 2.1 2.3
7.4 1.9 1.6 1.8
8.3 1.5 1.0 1.3
Function LSFitBoth -- Another Example
Another Example Array:
Slope 4
Intercept 25
Nonlinearity 18%
Noise 15%
Uncertainty 10%
X
i
Y
i
DX
i
DY
i
0.89 0.67 0.01 0.01
1 0.64 0.01 0.01
0.92 0.76 0.01 0.01
0.87 0.61 0.01 0.01
0.9 0.74 0.01 0.01
0.86 0.61 0.01 0.01
1.08 0.77 0.01 0.01
0.86 0.61 0.01 0.01
1.25 0.99 0.01 0.01
1.01 0.77 0.01 0.01
0.86 0.73 0.01 0.01
0.85 0.64 0.01 0.01
0.88 0.62 0.01 0.01
0.84 0.63 0.01 0.01
0.79 0.57 0.01 0.01
0.88 0.66 0.01 0.01
0.7 0.53 0.01 0.01
0.81 0.46 0.01 0.01
0.88 0.79 0.01 0.01
0.92 0.77 0.01 0.01
0.92 0.70 0.01 0.01
1.01 0.88 0.01 0.01
0.88 0.62 0.01 0.01
0.92 0.80 0.01 0.01
0.96 0.74 0.01 0.01
0.85 0.64 0.01 0.01
1.04 0.93 0.01 0.01
From Reed, Am. J. Phys. 57 #7 (1989) 645 : Linear Least Squares
The Results:
Using LSFitBoth
Slope Intercept
0.4
0.5
0.6
0.7
0.8
0.9
1.0
0.7
Y

Another instance for which this technique is appropriate is when the data shows a
large amount of scatter. In that case the wrong weighting scheme can throw things
off. The iterative LSBoth function does better than the simple weighted fit in Y.

Slope / Intercept 1.1668 -0.3651
Uncertainty 0.1382 0.1268
MinThis / SSRes 0.00002 578.05
alpha / beta 0.62 -0.36
gamma / delta -2.20 512.98
There is no LSFitBothSlope, LSFitBothIntercept, etc.
I figured it would clutter up the Function Wizard
Weighted in Y only
Slope Intercept
Slope / Intercept 0.93 -0.15
Uncertainty 0.13 0.12
R / Sy 0.67 6.95
SSreg / SSres 2480 1206.0
Unweighted
Slope Intercept
Slope / Intercept 0.93 -0.15
Uncertainty 0.13 0.12
R / Sy 0.67 0.07
SSreg / SSres 0 0.1
Goal Seek this cell 0.00 to be Zero
0.8 0.9 1 1.1 1.2 1.3
X
Yi
Unweighted
Weighted in Y
Weighted in X & Y
Another instance for which this technique is appropriate is when the data shows a
large amount of scatter. In that case the wrong weighting scheme can throw things
off. The iterative LSBoth function does better than the simple weighted fit in Y.
Based on this cell 1.1668
A good initial value is 0.93
X
Weighted
in X & Y
Weighted
in Y Unweighted
0.78 0.5 0.6 0.6
0.89 0.7 0.7 0.7
1 0.8 0.8 0.8
0.92 0.7 0.7 0.7
0.87 0.6 0.7 0.7
0.9 0.7 0.7 0.7
0.86 0.6 0.7 0.7
1.08 0.9 0.9 0.9
0.86 0.6 0.7 0.7
1.25 1.1 1.0 1.0
1.01 0.8 0.8 0.8
0.86 0.6 0.7 0.7
0.85 0.6 0.6 0.6
0.88 0.7 0.7 0.7
0.84 0.6 0.6 0.6
0.79 0.6 0.6 0.6
0.88 0.7 0.7 0.7
0.7 0.5 0.5 0.5
0.81 0.6 0.6 0.6
0.88 0.7 0.7 0.7
0.92 0.7 0.7 0.7
0.92 0.7 0.7 0.7
1.01 0.8 0.8 0.8
0.88 0.7 0.7 0.7
0.92 0.7 0.7 0.7
0.96 0.8 0.7 0.7
0.85 0.6 0.6 0.6
1.04 0.8 0.8 0.8
(***********************************************************
This is a Mathematica routine to do Weighted least squares fits.
It is to be used with the Mathematica/Excel Link for windows.
See http://www.mathematica.com/
If you don't have all that stuff -- don't sweat it.
You clearly have Excel and that's all you need for the
Weighted least squares fits.
************************************************************)
(***********************************************************
If this looks horribly ugly... that's because it is.
All it does is take the brain damaged output format of
the Regress comand (in Statistics`LinearRegression`) and
extract the useful (for us) values.
************************************************************)
<< Statistics`LinearRegression`
LSFit[X_, Y_, Yerr_] := Block [{
RegressResult,paramTable, anovaTable,
fitm, fitb, fitdm, fitdb, TStat, Pvalue,
r2val, sy, SSModel, SSRes, SSTotal
}, (
(* Perform Fit *)
RegressResult= Regress[
Transpose[{X, Y}], {1, x}, x, Weights -> 1/Yerr^2];
(* Get Fit and Uncertainty *)
paramTable = ParameterTable /. RegressResult;
{{fitb, fitm}, {fitdb, fitdm}, TStat, PValue} =
((FullForm[paramTable])[[1,1]])//Transpose;
(* Get R^2 value *)
r2val = RSquared /. RegressResult;
(* Get Model Sum of Squares and Residual Sum of Squares *)
anovaTable = (FullForm[ANOVATable /. RegressResult]) [[1,1]];
{SSModel, SSRes, SSTotal} =
{anovaTable[[1,2]], anovaTable[[2,2]], anovaTable[[3,2]]};
{{fitm, fitb},
{fitdm, fitdb},
{r2val, syNotYet},
{SSModel, SSRes}}
)]

Das könnte Ihnen auch gefallen