











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












In modern science, regression analysis is a necessary part of virtually almost any data reduction process. Popular spreadsheet programs, such as Quattro Pro, Microsoft Excel, and Lotus 1-2-3 provide comprehensive statistical program packages, which include a regression tool among many others.
Usually, the regression module is explained clearly enough in on-line help and spreadsheet documentation (i.e. items in the regression input dialog box). However, the description of the output is minimal and is often a mystery for the user who is unfamiliar with certain statistical concepts.
The objective of this short handout is to give a more detailed description of the regression tool and to touch upon related statistical topics in a hopefully readable manner. It is designed for science undergraduate and graduate students inexperienced in statistical matters. The regression output in Microsoft Excel is pretty standard and is chosen as a basis for illustrations and examples ( Quattro Pro and Lotus 1-2-3 use an almost identical format).
In a regression analysis we study the relationship, called the regression function , between one variable y , called the dependent variable , and several others xi , called the independent variables. Regression function also involves a set of unknown parameters bi. If a regression function is linear in the parameters ( but not necessarily in the independent variables! ) we term it a linear regression model. Otherwise, the model is called non-linear. Linear regression models with more than one independent variable are referred to as multiple linear models, as opposed to simple linear models with one independent variable.
The following notation is used in this work:
y - dependent variable ( predicted by a regression model ) y* - dependent variable ( experimental value ) p - number of independent variables (number of coefficients) xi (i=1,2, …p) - ith independent variable from total set of p variables bi (i=1,2, …p) - ith coefficient corresponding to xi b 0 - intercept (or constant) k=p+1 - total number of parameters including intercept (constant) n - number of observations ( experimental data points) i =1,2 … p - independent variables’ index j=1,2, … n - data points’ index
Now let us illustrate the classification of regression models with mathematical expressions:
Multiple linear model
General formula:
y = b 0 + b 1 x 1 + b 2 x 2 + … bpxp (1) or y = b 0 + i bixi i=1,2,… p (1a)
Polynomial (model is linear in parameters , but not in independent variables):
y = b 0 + b 1 x + b 2 x^2 + b 3 x^3 … bpxp, which is just a specific case of (1)
with x 1 = x, x 2 = x^2 , x 3 = x^3 …..xp = xp
Simple linear model
y = b 0 + b 1 x 1
It is obvious that simple linear model is just specific case of multiple one with k=2 (p=1)
Non-linear model
y = A(1-e-Bx), where A, B are parameters
In further discussion we restrict ourselves to multiple linear regression analysis.
We can rewrite this expression in form (1):
y = b 0 + b 1 x 1 + b 2 x 2 + b 3 x 3 , where (1b) x 1 = z, x 2 = z^2 and x 2 = z^3
In the next step we prepare the spreadsheet input table for regression analysis:
Table 2. Regression input
Data point # Dependent var. Independent variables j y* x 1 (=z) x 2 (=z^2 ) x 3 (=z^3 )
1 20.6947 2.5 6.25 15. 2 28.5623 3.1 9.61 29. 3 157.0020 8.1 65.61 531. 4 334.6340 12.2 148.84 1815. 5 406.5697 13.5 182.25 2460. 6 696.0331 17.9 320.41 5735. 7 945.1385 21.0 441.00 9261.
In order to perform a regression analysis we choose from the Microsoft Excel menu*:
Tools Data analysis Regression
Note that data analysis tool should have been previously added to Microsoft Excel during the program setup (Tools – Add-Ins – Analysis ToolPak).
The pop-up input dialog box is shown on Fig.1. Elements of this box are described in on- line help. Most of them become clear in the course of our discussion as well.
The “Input Y range” refers to the spreadsheet cells containing the independent variable y* and the “Input X range” to those containing independent variables x ( in our example x = x 1 , x 2 , x 3 ) (see Table 2). If we do not want to force our model through the origin we leave the “Constant is Zero” box unchecked. The meaning of “Confidence level” entry will become clear later. The block “Output options” allows one to choose the content and locations of the regression output. The minimal output has two parts “Regression Statistics” and “ANOVA ” (ANalysis Of VAriance). Checking the appropriate boxes in subblocks “Residuals” and “Normal Probability” will expand the default output information. We omit from our discussion description of “Normal Probability” output. Now we are ready to proceed with the discussion of the regression output.
Fig. 1. Regression input dialog box
Residual output
Example
In Microsoft Excel the residual output has the following format:
Table3. Residual output Observation (j)*
Predicted Y (yj)
Residuals ( r )
Standard Residuals (r’) 1 20.4424 0.2523 0. 2 28.9772 -0.4149 -0. 3 156.3982 0.6038 0. 4 335.5517 -0.9178 -1. 5 406.3355 0.2342 0. 6 695.6173 0.4159 0. 7 945.3121 -0.1736 -0.
* - Corresponding notation used in this handout is given in parenthesis
Residual ( or error, or deviation ) is the difference between the observed value y* of the dependent variable for the jth experimental data point (x1j, x2j, …, xpj, yj*) and the
ANOVA output
There are two tables in ANOVA (Analysis of Variance).
Example
Table 4. ANOVA output (part I) df SS MS F Significance F*
Regression 3 (dfR) 723630.06 (SSR) 241210.02 (MSR) 425507.02 (FR) 6.12E-09 (PR)
Residual (error) 3 (dfE)^ 1.70 (SSE)^ 0.57 (MSE) Total 6 (dfT) 723631.76 (SST) N/A (MST)
Table 4a. ANOVA output (part II) Coefficients* (bi)
Standard Error (se (bi))
t Stat (ti)
P-value (Pi)
Lower 95% (bL,(1-Pi))
Upper 95% (bU,(1-Pi))
Intercept (b 0 ) 0.52292226^ 1.77984111^ 0.293802778^ 0.7881^ -5.1413318^ 6. X Variable 1 (x 1 ) 2.91437225 0.73039587 3.990126957 0.0282 0.58992443 5.
X Variable 2 (x 2 ) 2.02376459^ 0.07318737^ 27.65182747^ 0.0001^ 1.79084949^ 2. X Variable 3 (x 3 ) -0.0009602^ 0.00206174^ -0.46574477^ 0.6731^ -0.0075216^ 0.
* - Corresponding notation used in this handout is given in parenthesis; N/A means “not available” in Microsoft Excel regression output.
Coefficients. The regression program determines the best set of parameters b (b 0 , b 1 , b 2 , … bp) in the model yj=b 0 +b 1 x1j+b 2 x2j+… bpxpj by minimizing the error sum of squares SSE (discussed later). Coefficients are listed in the second table of ANOVA (see Table 4a). These coefficients allow the program to calculate predicted values of the dependent variable y (y 1 , y 2 , … yn), which were used above in formula (2) and are part of Residual output ( Table 3).
Sum of squares. In general, the sum of squares of some arbitrary variable q is determined as:
SSq = j n(qj - qavg)^2 , where (3)
qj - jth observation out of n total observations of quantity q qavg - average value of q in n observations: qavg= jn^ qj)/n
In the ANOVA regression output one will find three types of sum of squares (see Table 4):
1). Total sum of squares SST :
SST = jn(yj - yavg)^2 , where (3a) yavg = jn^ yj)/n
It is obvious that SST is the sum of squares of deviations of the experimental values of dependent variable y* from its average value. SST could be interpreted as the sum of deviations of y* from the simplest possible model ( y is constant and does not depend on any variable x ):
y = b 0 , with b 0 = yavg (4)*
SST has two contributors: residual (error) sum of squares (SSE ) and regression sum of squares(SSR) :
SST = SSE + SSR (5)
2). Residual ( or error) sum of squares SSE :
SSE = jn^ (rj - ravg)^2 (6)
Since in the underlying theory the expected value of residuals ravg is assumed to be zero, expression (6) simplifies to:
SSE = jn^ (rj)^2 (6a)
The significance of this quantity is that by the minimization of SSE the spreadsheet regression tool determines the best set of parameters b= b 0 , b 1 , b 2 , …, bp for a given regression model. SSE could be also viewed as the due-to-random-scattering-of - y* -about- predicted-line contributor to the total sum of squares SST. This is the reason for calling the quantity “due to error (residual) sum of squares”.
3). Regression sum of squares SSR:
SSR = jn^ (yj - yavg)*^2 (7)
SSR is the sum of squares of deviations of the predicted - by-regression-model values of dependent variable y from its average experimental value yavg*. It accounts for addition of p variables (x 1 , x 2 , …, xp) to the simplest possible model (4) (variable y is just a constant and does not depend on variables x ), i.e. y = b 0 vs. y = b 0 + b 1 x 1 + b 2 x 2 + … + bpxp. Since this is a transformation from the “ non-regression model” (4) to the true regression model (1), SSR is called the “due to regression sum of squares”.
3). Regression mean square MSR ( regression variance ):
MSR = SSR /(k - 1) (13)
The number of degrees of freedom in this case can be viewed as the difference between the total number of degrees of freedom dfT (10) and the number of degrees of freedom for residuals dfE (12) :
dfR = dfT - dfE = (n - 1) - (n - k)
dfR = k - 1 = p (14)
Tests of significance and F-numbers The F-number is the quantity which can be used to test for the statistical difference between two variances. For example, if we have two random variables q and v , the corresponding F- number is:
Fqv = MSq / MSv (15)
The variances MSq and MSv are defined by an expression of type (8). In order to tell whether two variances are statistically different, we determine the corresponding probability P from F-distribution function:
P = P ( Fqv, dfq, dfv) (16)
The quantities dfq, dfv - degrees of freedom for numerator and denominator - are parameters of this function. Tabulated numerical values of P for the F-distribution can be found in various texts on statistics or simply determined in a spreadsheet directly by using the corresponding statistical function (e.g. in Microsoft Excel one would use FDIST(Fqv, dfq, dfv) to return the numerical value of P). An interested reader can find the analytical form of P = P ( Fqv, dfq, dfv) in the literature (e.g. [1, p.383]).
The probability P given by (16) is a probability that the variances MSq and MSv are statistically indistinguishable. On the other hand, 1-P is the probability that they are different and is often called confidence level. Conventionally, a reasonable confidence level is 0.95 or higher. If it turns out that 1-P < 0.95 , we say that MSq and MSv are statistically the same. If 1-P > 0.95 , we say that at least with the 0.95 (or 95%) confidence MSq and MSv are different. The higher the confidence level, the more reliable our conclusion. The procedure just described is called the F-test.
There are several F-tests related to regression analysis. We will discuss the three most common ones. They deal with significance of parameters in the regression model. The first
and the last of them is performed by spreadsheet regression tool automatically, whereas the second one is not.
1). Significance test of all coefficients in the regression model
In this case we ask ourselves: ”With what level of confidence can we state that AT LEAST ONE of the coefficients b (b 1 , b 2 , … bp) in the regression model is significantly different from zero?”. The first step is to calculate the F-number for the whole regression (part of the regression output (see Table 4)):
The second step is to determine the numerical value of the corresponding probability P (^) R (also part of the regression output ( see Table 4)) :
P (^) R = FDIST(FR, dfR, dfE) (18)
Taking into account expressions (12) and (14) we obtain:
P (^) R = FDIST(FR, k - 1, n - k) (18a)
Finally we can determine the confidence level 1 - PR. At this level of confidence, the variance “due to regression” MSR is statistically different from the variance “due to error” MSE. In its turn it means that the addition of p variables (x 1 , x 2 , …, xp) to the simplest model (4) (dependent variable y is just a constant) is a statistically significant improvement of the fit. Thus, at the confidence level not less than 1- P (^) R we can say: “ At least ONE of coefficients in the model is significant ”. FR could be also used to compare two models describing the same experimental data: the higher FR the more adequate the corresponding model.
Example
In our illustrative exercise we have PR= 6.12E-09 (Table 4), the corresponding level of confidence 1 - PR = 0. 9999. Therefore with the confidence close to 100% we can say that at least one of coefficients b 1 , b 2 and b 3 is significant for the model y = b 0 + b 1 x 1 + b 2 x 2 + b 3 x 3 , where x 1 =z, x 2 = z^2 and x 3 = z^3.
are non-zero.
If 1- P (^) R is not big enough (usually less than 0.95), we conclude that ALL the coefficients in the regression model are zero (in other words, the hypothesis that “the variable y is just a constant” is better than “it is function of variables x (x 1 , x 2 , …, xp) ” ).
Example
The regression output for the unrestricted model (y = b 0 + b 1 x 1 + b 2 x 2 + b 3 x 3 , where x 1 =z, x 2 = z^2 and x 3 = z^3 ) is presented in Table 4. Say, we want to test whether the quadratic and the cubic terms are significant. In this case the restricted model is:
y = b 0 + b 1 x 1 , (restricted model) (23) where x 1 = z
The subset of parameters consists of two parameter and m=2. By analogy with the input table for the unrestricted model (Table 2) we prepare one for the restricted model:
Table 5. Regression input for restricted model
Data point # Dependent var. Independent var. j y* x 1 (=z) 1 20.6947 2. 2 28.5623 3. 3 157.0020 8. 4 334.6340 12. 5 406.5697 13. 6 696.0331 17. 7 945.1385 21.
We perform an additional regression using this input table and as part of ANOVA obtain:
Table 6. Regression ANOVA output for the restricted model
df’ SS’ MS’ F’ Significance F’
Regression^1 689216 689216 100 1.70- Residual (error)^5 34415.70^^6883 Total 6 723632
From Table 4 and Table 6 we have:
SSE = 1.70 (error sum of squares; unrestricted model) MSE = 0.57 (error mean square; unrestricted model) dfE =(n - k)= 3 (degrees of freedom; unrestricted model) SS’E = 34415.70 (error sum of squares; restricted model)
Now we are able to calculate Fm=2 :
Fm=2 = {(34415.70-1.70)/ 2} / 0. Fm=2 = 30187.
Using the Microsoft Excel function for the F-distribution we determine the probability Pm=2 :
Pm=2 = FDIST(30187.72, 2, 3) Pm=2 = 3.50E-
Finally we calculate the level of confidence 1- Pm=2 :
1-Pm=1 = 1 - 3.50E- 1-Pm=1 = 0.
The confidence level is high (more than 99.99 %). We conclude that at least one of the parameters (b 2 or b 3 ) in the subset is non-zero. However, we can not be sure that both quadratic and cubic terms are significant.
3). Significance test of an individual coefficient in the regression model
Here the question to answer is: ”With what confidence level can we state that the ith coefficient bi in the model is significant?”. The corresponding F-number is:
Fi = bi^2 / [se(bi)]^2 (24)
se(bi) is the standard error in the individual coefficient bi and is part of the ANOVA output (see Table 4a). The corresponding probability
P (^) i = FDIST(Fi, 1, n - k) (25)
leads us to the confidence level 1- P (^) i at which we can state that coefficient bi is significant. If this level is lower than desired one we say that coefficient bi is insignificant. Fi is not part of spreadsheet regression output , but might be calculated by hand if needed.
However, there is another statistics for testing individual parameters, which is part of ANOVA (see Table 4a):
ti = bi / se(bi) (26)
The ti - number is the square root of Fi (expression (24)). It has a Student’s distribution (see [1, p. 381] for the analytical form of the distribution). The corresponding probability is numerically the same as that given by (25 ). There is a statistical function in Microsoft Excel which allows one to determine Pi ( part of ANOVA (see Table 4a)):
P (^) i= TDIST(ti, n-k, 2) (27)
Knowing the t-number for a coefficient bi we can calculate the numerical interval which contains the coefficient bi with the desired probability 1-Pi :
bL, (1- Pi)= bi - se(bi)t(1-Pi)* (lower limit) (31)
bU, (1- Pi)= bi + se(bi)t(1-Pi)* (upper limit) (31a)
t(1-Pi)=TINV(Pi, n-k) (32)
The standard errors for individual parameters se(bi) are part of ANOVA (Table 4a). The interval [bL, (1- Pi); bU, (1- Pi)] is called the confidence interval of parameter bi with the 1-Pi confidence level. The upper and lower limits of this interval at a 95% confidence are listed in the ANOVA output by default ( Table 4a; columns “Lower 95%” and “Upper 95%” ). If in addition to this default, the confidence interval at a confidence other than 95% is desired, the box “Confidence level” should be checked and the value of the alternative confidence entered in the corresponding window of the Regression input dialog box (see Fig. 1).
Example
For the unrestricted model (1b), the lower and upper 95% limits for intercept are “-5.1413” and “6.1872” respectively (see Table 4a). The fact that with the 95% probability zero falls in this interval is consistent with our conclusion of insignificance of b 0 made in the course of F-testing of individual parameters (see Example at the end of previous section). The confidence intervals at the 95% level for b 1 and b 2 do not include zero. This also agrees with the F-test of individual parameters.
In fact, analysis whether zero falls in a confidence interval could be viewed as a different way to perform the F-test (t-test) of individual parameters and must not be used as an additional proof of conclusions made in such a test.
Regression statistics output
The information contained in the “Regression statistics” output characterizes the “goodness” of the model as a whole. Note that quantities listed in this output can be expressed in terms of the regression F-number FR (Table 4) which we have already used for the significance test of all coefficients.
Example For our unrestricted model (1b) the output is:
Table 7. Regression statistics output*
Multiple R 0. R Square (R^2 ) 0. Adjusted R Square (R^2 adj) 0. Standard Error (Sy) 0. Observations (n) 7 * - Corresponding notation used in this handout is given in parenthesis
Standard error (Sy):
Sy= (MSE)0.5^ (33)
MSE is an error variance discussed before (see expression (11)). Quantity Sy is an estimate of the standard error ( deviation ) of experimental values of the dependent variable y* with respect to those predicted by the regression model. It is used in statistics for different purposes. One of the applications we saw in the discussion of “Residual output” (Standardized residuals; see expression (2a)).
Coefficient of determination R^2 ( or R Square):
SSR, SSE and SST are regression, residual (error) and total sum of squares defined by (7), (6a) and (3a) respectively. Th e coefficient of determination is a measure of the regression model as whole. The closer R^2 is to one, the better the model (1) describes the data. In the case of a perfect fit R^2 =.
Adjusted coefficient of determination R^2 ( or Adjusted R Square):
R^2 adj=1- {SSE / (n-k)} / {SST/ (n-1)} (35)
SSE and SST are the residual (error) and the total sum of squares (see expressions (6a) and (3a)). The significance of R^2 adj is basically the same as that of R^2 (the closer to one the better). Strictly speaking R^2 adj should be used as an indicator of an adequacy of the model, since it takes in to account not only deviations, but also numbers of degrees of freedom.
Table 10a. Formula map of ANOVA output (part II) Coefficients (bi)
Standard Error (se(bi))
t Stat (ti)
P-value (Pi)
Lower 95% (bL,(1-Pi))
Upper 95% (bU,(1- Pi)) Intercept (b 0 ) (26)^ (25) (27)^ (31)^ (31a) X Variable 1 (x 1 ) (26) (25) (27) (31) (31a) X Variable 2 (x 2 )… (26) (25) (27) (31) (31a)