Design of Experiments, Analysis of Variance, and Regression Analysis
Prerequisite Knowledge
This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.
Previously Covered in This Subject
- Design of experiments and analysis of variance (preview) — covered in Lecture 6 (Chi-Square Applications: Tests for Independence and Goodness of Fit)
- The t-test and the p-value decision rule — covered in Lecture 4 (Hypothesis Testing Procedures)
- Sample mean and sample variance — covered in Lecture 2 (Normal Distribution and Statistical Inference)
- Writing the null and alternative hypotheses — covered in Lecture 6 (Chi-Square Applications: Tests for Independence and Goodness of Fit)
This session has two parts. The first part introduces the design of experiments — how we plan an experiment so we can see what actually affects the final outcome — and then the analysis of variance (ANOVA), the statistical procedure that analyzes the specific design. The second part introduces regression analysis, in both its simple linear and multiple linear forms. The reference chapters are chapter 13 (design of experiments and analysis of variance) and chapter 14 (regression). The plan is to spend the first part of the time on the fundamental, basic design, and to take a few examples to address both topics broadly.
7.1 Design of Experiments
7.1.1 What the Design of Experiments Is About
What if you could know, before running a single trial, which ingredients of an experiment will actually move the final result? That is the question the design of experiments (DOE) answers. It is the deliberate planning of an experiment so that the effects we care about are visible and the effects we do not care about are kept quiet — a skill that decides whether an experiment teaches you something or merely gives you a pile of numbers.
The interior design analogy. The main intention behind a design of experiments is to observe what is going to affect the final outcome of an experiment. A convenient way to fix the idea is the example used here: the interior design of a house. After building a new house, everyone is interested in decorating it, and the final outcome of the whole exercise is the interior design itself. That final outcome is influenced by, or depends on, a set of factors: maybe the color of the walls, the lights, the floors, and the placement of the various objects in the house. There are situations where placing the objects in a proper sequence — as opposed to in a random fashion — can enhance the design effect and make the house much more appealing from the look point of view.
Map the analogy onto the statistics:
| Interior design | Experiment |
|---|---|
| The final look of the house | The response, or output variable |
| Wall color, lights, floors, object placement | Factors (independent variables) |
| Rearranging furniture and repainting | Changing the levels of the factors |
| A beautiful room may result from a combination of choices | Interaction between factors |
The analogy breaks at one point: a room's beauty is judged by the eye, while an experiment's outcome is judged by a number — but the planning logic is identical.
The effect itself is what we call the amount of variation. As far as the interior design is concerned, that variation will be affected by the individual factors, or by multiple factors, or by the combinations of the factors considered together — and that last possibility is a very important point. So what we are trying to do throughout is figure out how we are going to capture the variation, the total variation. If we want to address the total variation in a particular problem, we need to analyze it, and that is exactly what the design of experiments is for: once the design is identified, we can manipulate multiple input factors and determine their effects on the desired output. If a design does not give you a proper result in terms of your output, you think about another possible combination — whether you need to include another factor or not — and all of that comes into the picture.
Think of total variation as a fixed budget of "noise" that every experiment has. Good design spends as much of that budget as possible on factors you can explain, and leaves as little as possible to pure chance. The design of experiments is the planning that decides, before data collection, how the budget is split.
Scope of this discussion. The course keeps to the fundamental designs and the basic statistical analysis of them. Advanced designs (response surfaces, split-plot, Taguchi methods) exist, but the syllabus covers the foundation; everything advanced builds on the basic design in a routine fashion once the basics are understood.
7.1.2 Types of Designs and the Basic Principles
As far as the types of designs are concerned, there are single-factor designs, where you consider one factor; multiple-factor designs, where you consider several factors; and interaction-factor designs, where the interaction between factors matters. These are the types of designs available to us, and it is up to us which design we recommend for a given problem.
For the sake of the discussion, the basic recommended designs are:
- Completely randomized design — the simplest fundamental design. Every treatment is assigned to the experimental units entirely at random; in the Chemtech example coming up, the three assembly methods are assigned at random to 15 workers, five per method.
- Randomized block design — you divide the experimental units into blocks (groups of "similar" units) and then randomize the treatments within each block. Blocking removes the variation that comes from the differences between blocks — for example, testing three fertilizers on soil of different quality by putting all three on each soil type.
- Factorial design — you study two or more factors together, including their combinations. Here the interaction between factors can be detected — something a one-factor-at-a-time approach can never reveal.
There are many more advanced designs, but the discussion here is confined to these fundamental ones; the subsequent things follow in a routine fashion once the basic design is understood.
The two principles that keep an experiment honest. The first is randomization: in the example that follows, the employees at the plant were randomly selected and the assembly methods were randomly assigned, precisely so that no personal bias comes into addressing the problem. Randomization is the experiment's version of probability sampling in an observational study — it spreads the influence of unknown, uncontrolled factors evenly across the treatments. The second is replication: you should repeat the same experimental conditions — in the example, assigning the same method to five different employees — so that you can reduce the amount of bias that is within our control. Randomization and replication together keep the experiment honest.
Why does replication reduce bias? With one observation per treatment you have nothing to average over: a single worker's natural speed is indistinguishable from the effect of the method. With five workers per method, the random ups and downs of individual workers partially cancel out, and the method's true effect emerges. Randomization and replication are the tools that let a designed experiment make cause-and-effect claims — something an observational study can only hint at.
The three designs are not competing recipes; they are a ladder of control. The completely randomized design is the baseline, the randomized block design adds control over a known source of variation, and the factorial design adds the ability to see combinations working together.
Real-world: the completely randomized design, the randomized block design, and the factorial design are the workhorses of industrial experiments — agriculture, manufacturing, pharmaceutical trials and product testing all run on these three basic structures before any of the advanced designs are invoked.
Exam note: chapter 13 of the textbook is the reference for design of experiments and analysis of variance, and chapter 14 for regression. The book Design of Experiments by Montgomery is listed as further reading for anyone interested, but the syllabus and the textbook portion cover only the fundamental designs — and only what is relevant from the exam point of view is discussed. Roughly 90 percent of everything discussed so far in the course counts for the mid-semester exam.
7.1.3 ANOVA as the Tool for the Design
At a low level, the relationship between the two ideas can be put like this: the analysis of variance is the tool — like the scissors a tailor uses — and the design of experiments is what we want to build with that tool. For all the things a proper design needs, you need some specific tools, and that tool is the analysis of variance, ANOVA for short.
The need for such a tool is real. We know that the significance of variance is everywhere, but at this point the question is how to analyze it: at times it is very difficult to analyze the total variation. You can come up with the total variation, but you do not know which factors are influencing it more and which factors are contributing less. Analysis of variance is one such statistical tool that helps us address exactly that.
The same basic intention appears in regression, which is discussed later in the session: your main intention is to understand the effect of the output. In our language, we call them dependent variables and independent variables — dependent variables are the response variables, and independent variables are the input factors. With the help of those independent variables, we study how the output is affected. Even more precisely, in regression we will get to know which factors are significantly contributing and which are not; if they are not significantly contributing, we try to eliminate them and remodel the problem.
The conceptual heart of ANOVA is the decomposition of variation. The total variation is decomposed into the variation between the treatments and the variation within the treatments. Generally speaking, the between-treatments variation comes from assignable causes — the three different methods we manipulate are within our control — while the variation within a treatment turns out to be chance, or error variation. The basic idea: the more you decompose the design, the better you can judge it. For example, if a single-factor design accounts for 70% of the variation through the treatment, then it is plain that the remaining 30% is left to chance. The main motto is to minimize these error causes, or chance causes, as much as possible.
Pictured as a bar: draw one bar of height 100% labeled "total variation." If a single factor explains 70% of it, color 70% of the bar in one color — assignable causes, the factor's effect — and leave 30% shaded as chance. The goal of every refinement is to shrink the 30% strip. That is the whole reason for introducing the different possible designs: the more designs we introduce — including interaction effects, because combinations of factors also influence the outcome, exactly as combinations of factors enhance the beauty of a house — the more the within-treatment variation reduces.
To do that, one way alone may not make sense — you ask whether you can include any other possible factors, you include them, and you observe. If you go on refining your designs, your chance causes will diminish. Each added factor or interaction is a transfer of variation out of the "chance" column and into the "explained" column.
7.1.4 Exam Notes
Exam note: chapter 13 is the reference for this design of experiments and analysis of variance discussion. The chapter carries a full set of worked example studies — the Chemtech filtration-system assembly experiment, which we work through in the next section, and an observational study at National Computer Products comparing quality-awareness exam scores across three plants, among others. The further reading for anyone interested is the book Design of Experiments by Montgomery, but the syllabus and the textbook portion cover only the fundamental designs, and only what is relevant from the exam point of view is discussed.
7.2 From Two Means to Many: Why ANOVA Exists
7.2.1 The Two-Sample Comparison and the t-Test
Suppose you want to know whether two types of music change the mean performance of a mental task. You have two groups of people, two sample means, and one question: is the difference real, or just luck? This is the familiar territory of the Z test and the t test — the tools you already know — extended from a single population to a comparison.
Most of you are already familiar with the Z test and the t test. In that discussion, we worked with a single population and tried to validate logical statements about it. The extension here comes when a comparison is involved. Suppose an experiment aims to determine whether two types of music have different effects on the mean performance of a mental task. Now we are talking about population one and population two, and we want to make a judgment on which one is better — whether population one's performance is better than population two's and so on. We are no longer testing a single mean; we are testing whether the two means are equal:
The two-sided alternative is the case being considered, but depending on the context it may be greater than or less than . To validate this, you again use the t test or the Z test — for the sake of discussion here we go with the t test. You calculate the test statistic and the p-value; if the p-value is less than alpha, you reject the null, and so on. This is all routine business; these two-mean cases are not going to be asked in the exam by themselves — they are introduced only to motivate what comes next.
7.2.2 Three or More Means: The Pairwise t-Test Problem
Now suppose we are interested in assessing the relative effects of three types of music, or four types of music. It is no longer a comparison of two; if it is more than two, we write
At first glance this looks like a simple extension. But when you want to validate it, if you stick with the t test you need to consider two populations at a time. You ask whether there is a significant difference between one and two, between two and three, between one and three — and so on. With two population means you need one simple t test; when it extends from two to three, there is a set of combinations of t tests to perform. If you extend the idea to five populations at a time — — the number of t tests increases accordingly: you take all combinations of the populations two at a time and validate each one. This is a tedious, complicated thing to expect: the number of pairings grows quickly, and when the number of populations increases it becomes very difficult to list out all the possible t tests and comment on the situation.
How quickly does the number of tests grow? The count of pairwise comparisons among populations is the number of ways to choose 2 populations out of , written :
| Number of populations | Pairwise t tests needed |
|---|---|
| 2 | 1 |
| 3 | 3 |
| 4 | 6 |
| 5 | 10 |
| 6 | 15 |
So three populations already demand three separate t tests, and five populations demand ten. And each individual test has its own chance of error — every "reject" you check inflates the overall chance of a false conclusion. This is why a different idea is needed.
To avoid these difficulties, instead of doing the pairwise t tests two at a time, the idea is: what if we consider the variation among these situations instead of talking in terms of means? If we take the variation, we try to find out how best it influences the problem by capturing the variation — and with a single captured quantity we can address five, six, seven populations at once. That is the concept of the analysis of variance. At its lowest level, ANOVA is an essential extension of the logic of the t test to those situations where we wish to compare the means of three or more populations: whenever more than two population means are to be considered concurrently, the analysis of variance is the better, recommended approach.
One number instead of many tests. The whole trick of ANOVA is to stop asking "is this pair different?" ten times, and instead ask once: "how much do these means spread apart compared with how much they'd be expected to spread if the null were true?" The between-treatments spread and the within-treatments spread are each captured by a single number, and the ratio of those two numbers settles the question for all populations at once.
7.2.3 The Variation Viewpoint: What Small and Large Variability Mean
Consider the hypothesis and not all population means are equal. Think about what the world looks like if the null hypothesis is true. The picture used here is the sampling distribution of the sample means: you know that follows a normal distribution (assuming, as we do, that the population comes from a normal distribution). If the null is true — the three population means are equal — then the sample means will also be close together. The closer the three sample means are, the weaker is the evidence we have to reject the null hypothesis; the more the sample means spread apart, the stronger is the evidence to reject. That is the conclusion in terms of averages.
But the approach here is not to inspect the sample means directly — it is to look at the variability. There are two possibilities: the variability among the sample means may be small, or the variability among the sample means may be large. If the variability among the sample means is small, which hypothesis does common sense tell us to support? The null hypothesis — because when the null is true the means are equal, so their variation is small. If the variability is large, it supports the alternative. That is the whole reasoning being established here.
To make this quantitative we need two things: the population mean and the population variance . The population mean is unknown, so we replace it with the grand mean, written as ("x double bar"), because we have three sample means and we need one reference point. The population variance is also unknown, so we introduce the variability through two best estimates. When the null hypothesis is true, we anticipate one particular variability: the variation between the sample means, which we call the variability between the treatments (between the methods). The between-treatments variation will give a reliable estimate of the population variance when the null hypothesis is true. When the alternative hypothesis is true, the situation is different: if you go with the variation between the treatments under the alternative, your estimate of will overestimate. So instead of relying on the between variation, we turn to the within variation: we find the variation within the treatments and use that. The rule of thumb as stated here: under the null hypothesis you calculate the variation between the treatments; under the alternative hypothesis you calculate the variation within the treatments.
Scope: when each estimate is trustworthy. The between-treatments estimate of is unbiased only when the null hypothesis is true — when the population means are equal. If the means differ, the between estimate is inflated, and its bigness is exactly the signal we want. The within-treatments estimate is built from the spread inside each treatment, so it stays unbiased whether the null is true or false. That asymmetry is the engine of the F test: compare the two estimates, and if the between one is much larger than the within one, the means cannot all be equal.
The whole thing rests on one decomposition: the total variation can happen between the treatments or within the treatments. You are bifurcating the total variation, decomposing it into the variation between the methods and the variation within the methods. The between-treatments variation corresponds to the assignable causes we control, and the within-treatments variation is the chance or error component.
Visualize it as two histograms side by side. On the left, the sampling distribution of the sample means when the null is true: one bell curve centered at , and the three sample means sitting close together near the middle — close, so small between-variation, weak evidence against . On the right, the null false: three separate bells centered at different , and the three sample means scattered far apart — spread out, so large between-variation, strong evidence against . The one-sentence takeaway: the spread of the sample means is the evidence; the width of each individual bell is the noise we must compare it against.
Q: If the variability among the sample means is small, which hypothesis do we support — the null or the alternative? A: Small variability among the sample means supports the null hypothesis. The reasoning: when the null is true the population means are equal, so the sample means are close together and their variability is small. Large variability among the sample means supports the alternative. That is exactly the common-sense conclusion.
7.2.4 Recap: From Two Means to Many
The chain of reasoning for this section: the t test handles two means; more means means many pairwise tests; many tests is tedious and error-prone; so we compare one number (between-treatment spread) with another number (within-treatment spread). The section that follows shows the exact formulas for those two numbers and the F test that compares them, on the Chemtech filtration system example.
7.3 One-Way ANOVA: The Chemtech Filtration System Example
7.3.1 The Problem Setup
The example is the fundamental one from the textbook. A company (Chemtech) wants to develop a new filtration system, and the interest is in observing the response of this new filtration system — which is the dependent variable in our language. The components for the new filtration system will be purchased from several suppliers, and Chemtech will assemble the components at its plants in Columbia and South Carolina. The industrial engineering group is responsible for determining the best assembly method for the new filtration system. Here the assembly method is the independent variable, or the factor that influences the filtration system: different assembly methods will affect the new filtration system differently. The company is interested in validating whether there is any significant difference among the three methods they are suggesting — method A, method B and method C — and, in the end, in determining which assembly method can produce the greatest number of filtration systems.
This is a textbook case of the completely randomized design from the previous section: one factor (assembly method), three treatments (the methods), and a quantitative response (units produced per week). The three methods define three populations — all employees who would use method A, all who would use method B, all who would use method C — and the statistical question is whether the mean production of those three populations is the same.
7.3.2 Randomization and the Data
The schematic setup is simple. The population of interest is the employees at the plants in the different places mentioned. From that population, 15 employees were randomly selected. The purpose of using randomness is that no personal bias should come into addressing the problem — randomization is one of the principles of any specific design, along with replication, which reduces the amount of bias within our control. Each of the three assembly methods is then randomly assigned to five employees: method A to five employees, method B to five, method C to five, and they work it out to see which one is better and whether the difference is statistically significant. The data considered are the number of units assembled by each employee during one week, shown in the table below. Because each method is used by five workers, we say the experiment has five replicates per treatment.
| Method A | Method B | Method C |
|---|---|---|
| 58 | 58 | 48 |
| 64 | 69 | 57 |
| 55 | 71 | 59 |
| 66 | 64 | 47 |
| 67 | 68 | 49 |
| Sample mean : 62 | Sample mean : 66 | Sample mean : 52 |
| Sample variance : 27.5 | Sample variance : 26.5 | Sample variance : 31.0 |
The notation, with the definitions the example will use:
- — the mean of the -th population (here, the mean number of units produced per week by method ).
- — the observation of the -th observation for treatment ; so we have , and so on.
- — the number of observations in treatment : for method A there were five observations, similarly for B and C.
- — the sample mean of treatment .
- — the sample variance of treatment .
- — the total sample size: .
There are different cases to keep in mind: one with equal sample sizes, as here, and the other with unequal sample sizes. All the formulas in this section handle both, but the arithmetic in the worked example is simplest in the equal-size case.
Assumptions for analysis of variance (stated in the textbook before any ANOVA run):
- For each population, the response variable is normally distributed — the units produced per week must be roughly bell-shaped for each assembly method.
- The variance of the response variable, , is the same for all populations — the spread around each method's mean should be comparable.
- The observations must be independent — one employee's output must not influence another's.
What goes wrong if they fail: if variances differ wildly, the F test's error rate is no longer accurate; if the data are severely non-normal with small samples, the p-values lose meaning (though ANOVA is fairly robust to non-normality when sample sizes are equal, as they are here); if observations are not independent, the experiment is effectively smaller than it looks.
7.3.3 The Hypotheses
Let be the mean number of units produced per week by method A, by method B, and by method C. At the population level we want to verify
That is the real objective: whether the three sample means observed are different enough for us to conclude that the population means corresponding to the three assembly methods are different. One way to address the problem is to perform the three pairwise combinations of t tests and come to a conclusion; the other way, the one we take, is to capture the amount of variation and see whether it makes sense.
Notice what the alternative does not say: it does not claim all three means differ — only that at least two of them do. If the null is rejected, the ANOVA itself does not tell us which pair differs; pinning that down is the job of follow-up procedures such as Fisher's LSD, covered in later sessions.
7.3.4 The Sample Mean and Variance Formulas
The formulas are the standard ones you already know: " is summation xi by n" and " is summation xi minus x bar whole square by n minus 1." For each treatment :
To get we add all five observations of that method and divide by 5. The sample means for the three methods come out as (method A), (method B), and (method C). Quick check on method A: . For method C: . The corresponding sample variances , , are computed from the squared deviations around each sample mean. For method A, the five deviations from 62 are ; their squares are , summing to 110, and
The same calculation for method B gives and for method C gives . The pooled quantity SSE below uses exactly these variances and lands on the published value 340, which is the check that matters.
From the three sample means we get the grand mean, the overall mean, the reference point that replaces the unknown population mean :
The verbal description: "X double bar here is a grand mean... divided by 3, which is turned out to be 60." For equal sample sizes this simple average of the three sample means equals the overall average of all observations — if the sizes were unequal, the grand mean would instead be the weighted average . Under the null hypothesis, this grand mean of 60 is the best single estimate of the common population mean .
7.3.5 Between-Treatments Variation: SSTR and MSTR
The between-treatments estimate of the population variance is the mean square due to treatments, abbreviated MSTR, built from the sum of squares due to treatments, SSTR. Here the treatments are the three methods: method A, method B and method C, so , and the sum runs over to :
The verbal description: "the formula... times minus whole square." This is the same structure as the simple variance formula , with each sample mean playing the role of and the grand mean playing the role of , weighted by the number of observations in each treatment. Substituting:
With treatments, the degrees of freedom are , and the mean square due to treatments is
So the between-treatments variation captured by this formula is MSTR = 260, the estimate we rely on when the null hypothesis is true. Why divide by ? The three sample means are free to vary only in independent directions once the grand mean 60 is fixed — knowing any two of them forces the third, since their average must stay 60.
7.3.6 Within-Treatments Variation: SSE and MSE
The within-treatments estimate of the population variance is the mean square due to error, MSE, built from the sum of squares due to error, SSE — also called the sum of squares due to chance, in line with the chance-causes view of the within variation. The formula pools the sample variances of the treatments:
With , each term is , and the computed value is
So SSE = 340. The degrees of freedom within treatments are , so
When the sample sizes are equal, MSE is simply the average of the three sample variances: . So the complete variation is now decomposed into two pieces: the variation due to the methods, numerically captured as 260 (between the methods), and the variation within the methods, captured as 28.33.
Note the contrast between the two estimates: 260 is over 9 times 28.33. If the null hypothesis were true, both numbers would be estimates of the same and would sit close together, near a ratio of 1. A ratio this large is the first signal that the means are not equal — the formal test is next.
7.3.7 The F Statistic and the Decision
Whenever we want to compare two variations — here the between-treatments variation against the within-treatments variation — the comparison is of the form , and the distribution that governs the comparison is the F distribution (the discussion does not go into the F distribution tables in detail; the p-value route is used). The F statistic is
Always remember the structure: "MSTR by MSE." The MSE always sits in the denominator; the reason for that placement is a concept that will be explained later, not now. (Preview of the reasoning: MSE is unbiased whether the null is true or not, so it is the natural yardstick; MSTR is the number that inflates when the means differ, so the ratio grows exactly when there is something to detect.) The degrees of freedom are 2 in the numerator and 12 in the denominator.
Pitfall: swapping the ratio. A classic beginner mistake is to compute . The F statistic is always — the between estimate over the within estimate — with the numerator degrees of freedom and the denominator degrees of freedom . Swapping the ratio would shrink the test statistic and make a real difference look small.
The decision logic is the usual p-value logic. If , reject the null hypothesis; if , accept the null hypothesis. For the portion of the F table with 2 and 12 degrees of freedom, the right-tail area is examined: for an F value of about 6.93, the area to the right is 0.01. Our F value of 9.18 lies beyond 6.93, so the area to its right must be less than 0.01 — the p-value is below 0.01, well below . Without any doubt the p-value is less than alpha, so we reject the null hypothesis and conclude that not all population means are equal. When you run this in Excel or Minitab, you can witness the exact p-value directly — the textbook reports the exact value as 0.004 — and verify leisurely what the value turns out to be.
Visual intuition: draw the F distribution for — a right-skewed curve starting at 0, rising to a low peak near 1, and trailing off to the right. The p-value is the area under the curve to the right of the observed , which sits far out in the tail. The one-sentence takeaway: the farther the ratio sits in the right tail, the less plausible it is that both estimates came from the same variance — and the stronger the evidence against equal means.
7.3.8 The ANOVA Table
Always expect the analysis of variance to be presented as a table — this is how Excel and most software report ANOVA output. The first column stands for the source of variation, the second column stands for the sum of squares, the third column stands for the degrees of freedom, the fourth column stands for the mean square, and then come the F statistic and the p-value. The source of variation for this single-factor problem has three rows: methods (the one factor being considered), error, and total.
| Source of variation | Sum of squares | Degrees of freedom | Mean square | F statistic | p-value |
|---|---|---|---|---|---|
| Methods (treatments) | 520 | 2 | 260 | 9.18 | < 0.01 |
| Error | 340 | 12 | 28.33 | ||
| Total | 860 | 14 |
The total variation is the sum of squares due to the total, SST, and the identity always holds:
The verbal statement: "It is always true... the total variation is now decomposed into the variation between the methods and the variation within the methods." So , with no doubt. The same additivity holds for the degrees of freedom: , and equivalently , since the total degrees of freedom are . The computation in full: SSTR = 520 with degrees of freedom, MSTR = 260; SSE = 340 with degrees of freedom, MSE = 28.33; and the F statistic with numerator 2 and denominator 12.
Worked example: filling the whole ANOVA table from the three sample means and variances.
Given: , , , , , , .
Step 1 — grand mean: .
Step 2 — treatments row: ; ; .
Step 3 — error row: ; ; .
Step 4 — total row: ; .
Step 5 — F statistic: .
Step 6 — decision at : exceeds the 0.01 critical value 6.93, so ; reject and conclude the three methods' population means are not all equal.
Sense-check: MSTR (260) is roughly nine times MSE (28.33); such a lopsided ratio cannot plausibly come from two estimates of the same variance, which is exactly what the F test confirms.
7.3.9 Student Questions and Answers
Q: In Excel, will the results turn out to be the same as what we calculated manually — SST and the other quantities? A: Yes, the results in Excel are the same. The actual concept to carry away is that you cannot do all the designs in Excel — some designs are not available there. If you are working with Excel, the mid-semester exam may need to be framed in a different fashion; whether that happens will be instructed, so no need to decide anything now.
Q: Does anyone have any idea how to do this particular problem with R or any other software? A: No — I did not work it out in Excel; I calculated it manually. The manual calculation is exactly the six steps in the worked example above, and software reproduces the same numbers.
Q: Does the same p-value logic hold for the F statistic as for the Z, t and chi-square tests? A: Yes — the same logic applies on a similar note. This p-value is also read in terms of the right-tail value, exactly as the p-values for Z, t and chi-square were discussed. If reject the null; if accept it.
7.3.10 Exam Notes
Exam note: if an analysis of variance question is asked, instead of reporting the information here and there, the ANOVA is always tabulated — source of variation, sum of squares, degrees of freedom, mean square, F statistic and p-value — exactly the picture that Excel and software give you. Remember the identity , the degrees-of-freedom arithmetic (, , ), the F statistic with MSE in the denominator, and the p-value decision rule reject, accept. The F p-value is read from the right tail, like the Z, t and chi-square p-values. All the detail is in the book — chapter 13 covers this discussion; every value shown here matches what you can look up there.
7.4 Simple Linear Regression
7.4.1 From ANOVA to Regression
The regression discussion shares the same basic intention as ANOVA: understanding the effect on the output. In our language, dependent variables are the response variables and independent variables are the input factors. With regression we can go one step further and pinpoint which factors are significantly contributing and which are not; if some are not significantly contributing, we eliminate them and remodel the problem. The first building block is simple linear regression — one independent variable and one dependent variable, both continuous.
So the thread across the session is: design of experiments plans the experiment, ANOVA analyzes whether a categorical factor's levels differ, and regression analyzes the effect of continuous input variables on a continuous output. The same vocabulary — dependent variable, independent variable, significant contribution — runs through all three.
7.4.2 The Model and What the Slope Means
Given a set of observed points , we want to find one particular line that comes close to the points. If the observed value and the expected value were the same, the error would be minimum — but a zero error is not possible practically; what we try to achieve is that the expected value of the error is 0. The line is written
where is the estimated value of the dependent variable for the -th observation, is the observed value, (B0) and (B1) are the best replacements for the population parameters and of the relation , and is the independent variable. The meaning of the slope: if is positive, there is a positive linear relationship; if is negative, there is a negative linear relationship; if is 0, there is no relation existing between and . These are the three possible combinations.
The error idea, made precise. The population model is , where (the Greek letter epsilon) is the error term — the part of that the line cannot explain. The line itself, , describes the mean of for a given . No real data sit exactly on a line: observed points deviate from it, and those deviations are the errors. A zero error is not possible practically, but the expected value of the error should be zero — deviations should not systematically favor one side of the line.
The y-intercept is the point where the line crosses the y-axis (the value of when ), and the slope is the expected change in for a one-unit increase in . If , then for every extra unit of , is expected to rise by 5 units — this number is the practical answer regression gives.
7.4.3 The Principle of Least Squares
How do we pick the one best line out of infinitely many? Plot the observed values against the fitted line: there is a deviation between each observed point and the line — some points sit on the line, others deviate from it. The moment we find values of and such that the error is minimum, we have the best fitted line. That is the principle of least squares: the sum of squares of the residuals is always minimum. The residual is , so we minimize
The verbal description: "summation i equals 1 to n of yi minus B0 minus B1x whole square — this is the absorbed value and this is the expected value; this total is my residual." To find the minimizing values we use calculus: take the partial derivative with respect to and equate it to 0, which gives one formula for ; take the partial derivative with respect to and equate it to 0, which gives one formula for . Setting the derivatives equal to zero picks out one best possible combination from infinitely many numbers — the line closest to the observed values, the one with least error.
Why squares and not plain errors? If we minimized , positive and negative deviations would cancel each other — a line that misses every point by a lot could still score zero. Squaring makes every deviation count, punishes large misses extra hard, and makes the calculus clean. That is the whole reason the criterion is the sum of squared residuals.
The derivation, completed. Minimize . Take the partial derivative with respect to :
Divide by and split the sum:
which rearranges to the first normal equation:
Now take the partial derivative with respect to (the chain rule brings down a factor ):
Dividing by and splitting the sum gives the second normal equation:
Solve equation (1) for :
Substituting this into equation (2) and collecting the terms on one side:
The bracketed quantities are exactly the squared-deviation sums, so
These are the standard closed-form formulas given in the textbook (Chapter 14, formulas 14.6 and 14.7), and the appendix of that chapter carries this calculus derivation in full — the same derivation shown here. Dimensional check: the numerator and denominator both have units of "x-deviation times y-deviation" and "x-deviation squared", so the slope has units of per — exactly what a slope should be.
7.4.4 Worked Example: Computing the Best-Fit Line
The example is the trucking problem (the name is garbled in the recording as "auto periodic"; the point is the computation itself). The given (or computed) values are and , where and . If a calculation is asked in the exam, and will be given, and you compute the four deviation columns: , , , and .
Worked example: least squares line for the trucking data.
The data and the column computations:
| 1 | 14 | −1 | 1 | −6 | 6 |
| 3 | 24 | 1 | 1 | 4 | 4 |
| 2 | 18 | 0 | 0 | −2 | 0 |
| 1 | 17 | −1 | 1 | −3 | 3 |
| 3 | 27 | 1 | 1 | 7 | 7 |
| Sum | 4 | 20 |
Walk through the columns. With , the deviations are , i.e., −1, 1, 0, −1, 1; squaring them gives 1, 1, 0, 1, 1, which sums to 4. With , the deviations are , i.e., −6, 4, −2, −3, 7. Multiplying the two deviation columns element by element gives 6, 4, 0, 3, 7, which sums to 20. The slope is then
and the intercept is
The estimated line — the best fitted line — is
Sense-check. The data climb with : the largest values (24 and 27) sit at the largest (x = 3), and the smallest values (14 and 17) sit at the smallest (x = 1). The line crosses the y-axis at 10, and it passes through : substituting the means gives . Both checks confirm the fitted line is consistent with the data.
Among infinitely many lines there is no other combination like or : is the best one because it takes care of the minimum error, the smallest possible error. And for any value of you can predict : substitute the value of into and compute. For example, at the prediction is .
Visual intuition: draw the scatter plot with on the horizontal axis and on the vertical axis; the five points cluster around an upward diagonal. The fitted line cuts through the cloud, with some points above it and some below. The vertical distance from each point to the line is its residual; the best line is the one that makes the sum of the squared vertical distances as small as possible.
7.4.5 Student Q&A: How Is the Best Line Chosen?
Q: (A student tries to guess how the best line is identified.) Is it decided by something like P greater than 0.5? A: Nothing to do with P. The best line is decided in terms of error: the observed values deviate from the line, and we choose the line with a minimum error, the smallest error. Zero error is not possible practically, but we aim for the expected value of the error to be 0.
Why did the guess seem plausible? In hypothesis testing the p-value decides reject or accept, so a natural leap is that the line is chosen by a probability rule. But picking a line is an estimation problem, not a testing problem: there is no hypothesis being accepted or rejected here — there are infinitely many candidate lines and one criterion (smallest squared error) that selects the best. The p-value enters only later, when we ask whether the fitted slope is significantly different from zero.
7.4.6 Exam Notes
Exam note: in calculation-oriented questions, and will be given; compute and , then the four deviation columns , , , , then as the ratio of the two column totals, then , and finally write the estimated equation . You should also be able to predict for a given by substitution. The exam mixes two kinds of questions: a few will be calculation-oriented, and a few will give an output and ask for your inference — interpretation skills matter right from the beginning, since you all know how to do the calculations.
Exam note: the calculation template is always the same five moves — means, deviation columns, ratio, intercept, equation. The next section shows the mirror-image question: when the output is given instead of the data, read the equation straight from the coefficients column.
7.5 Reading Regression Output: Simple and Multiple
7.5.1 The Three-Part Output
For the armored pizza trucking problem, the output (available in Excel) has three portions: one portion is the regression summary, another portion is the ANOVA, and the third portion is the regression coefficients. These are the three standard blocks of every regression output, in order:
- Regression statistics — the summary block: the correlation coefficient , the coefficient of determination , the adjusted , the standard error, and the number of observations. This block answers "how well does the model fit?"
- ANOVA — the analysis-of-variance block: source (regression, residual/error, total), sum of squares, degrees of freedom, mean squares, the F statistic, and the F p-value. This block answers "is the model as a whole significant?"
- Coefficients — the coefficients block: the intercept and each coefficient with its standard error, t statistics, and p-values for each predictor. This block answers "which variables contribute significantly?"
The column of interest for writing the equation is the coefficients column: the intercept is nothing but and the coefficient of is — the y-intercept is the constant, and the coefficient of x is the slope.
7.5.2 The Armored Pizza Trucking Example: The Equation from the Output
From the coefficients column of the simple regression output for the armored pizza trucking problem, the intercept is 1.27 and the slope is 0.067, so
The verbal description: "the way we wrote plus where is 1.27 plus 0.067 on a similar note." If you are asked to write a regression equation from an output, the coefficients column gives you everything: .
Worked example: reading the equation from the coefficients column.
Given a regression output whose coefficients column reads:
| Coefficients | |
|---|---|
| Intercept | 1.27 |
| x (miles) | 0.067 |
Step 1 — identify the roles: the first row is the intercept , the row under the predictor name is the slope .
Step 2 — assemble the equation: .
Step 3 — use it: predict for miles: .
Sense-check. The slope 0.067 is positive and small: each extra mile adds about 0.067 units of the response (about 4 minutes if the response is hours). At 100 miles the predicted travel time is just under 8 hours — a plausible magnitude for a day of trucking.
7.5.3 Overall Significance and Individual Significance
Two significance questions are answered by the same output. The ANOVA portion tells us the overall significance — whether the regression model as a whole is valid or not — captured by its p-value: if the p-value is less than alpha, say the standard , this minimum value indicates that the regression is significant, and it is a good model being suggested for this problem. The last column, the p-values of the coefficients, tells us about individual contributions: with the help of the p-value of each coefficient we can say whether each variable — for instance, the miles traveled — contributes significantly or not. For this particular example, looking at the p-values, both the overall model and the individual variable are significantly contributing.
The two questions are different and both get an answer from one output:
| Question | Block of output | p-value to look at | Decision |
|---|---|---|---|
| Is the model as a whole useful? | ANOVA | F p-value | → model significant |
| Does variable contribute? | Coefficients | t p-value for the coefficient | → variable significant |
For the simple regression case the two questions usually agree, because with one predictor the overall F test and the t test on the slope are testing the same thing. The interesting separation appears when there are several predictors — the next subsection.
7.5.4 Multiple Linear Regression Output: A Preview
The same reading applies to multiple linear regression, discussed in more detail in the next session. There we write the model with two independent variables:
For the multiple-regression output shown, the coefficients column lists the intercept and the two slopes, with the two slope values stated as 0.06 and 0.93. These numbers match the standard trucking example in the textbook: with miles traveled () and number of deliveries () as predictors of travel time, the estimated equation is
so the professor's "0.06 and 0.93" are the rounded slopes for miles and deliveries respectively. Note that the slope for miles changed between the simple and multiple outputs (0.067 alone, 0.061 with deliveries added) — in multiple regression each coefficient is the effect of that variable with all other variables held constant, which is why it can differ from the simple-regression slope.
The interesting point to watch: at times the overall significance is there — the model is significant — but if you carefully observe the individual p-values, a few of the independent variables turn out not to be significantly contributing. That contrast between overall significance and individual significance is an important point to address as far as the regression concepts are concerned, and the discussion will continue from this output in the next session, for both simple and multiple linear regression.
Pitfall: overall significance is not a license for every variable. The ANOVA p-value says the model as a whole beats the no-variable baseline; it does not certify each predictor. A textbook case: an overall-significant model whose coefficient table shows one predictor with a large p-value — that variable adds little once the others are in the model. The remedy is to drop the weak variable and remodel. Always check both p-values: the ANOVA row for the model, the coefficients column for the variables.
7.5.5 Software for Regression
Real-world: in Excel, the option lives in the Data Analysis portion of the ribbon — you need to add the Analysis ToolPak add-in ("analysis tool pack"), which enables the Data Analysis menu, and then work out the regression there. For simple and multiple regression, Excel is enough. For logistic regression and the advanced regressions, there is no such option in the Data Analysis tool: you need to write R code, or you can get those results with Python. In SPSS, predefined options are also there, and logistic regression is also available in the add-ins/toolpak of SPSS. For simple and multiple regression the Excel route works fine.
| Task | Tool |
|---|---|
| Simple and multiple linear regression | Excel Data Analysis (with Analysis ToolPak add-in), Minitab, R, Python, SPSS |
| Logistic and advanced regressions | R code or Python; SPSS add-ins/toolpak |
7.5.6 Student Questions and Answers
Q: Is there an option in the Excel Data Analysis for these regressions, and how do we handle logistic regression? A: In the Excel Data Analysis portion there is an option — you should add the Analysis ToolPak first, which brings up Data Analysis, and then work it out. Simple and multiple linear regression are available there; logistic and the advanced regressions are not in the Data Analysis tool, so for those you need to write R code or use Python. SPSS has predefined options as well, and logistic is also available in its add-ins/toolpak.
Exam note: from a regression output, the standard exam question asks for three things: write the equation from the coefficients column (intercept and slope), state the overall significance from the ANOVA p-value, and state the individual significance from the coefficient p-values.
Exam Guidance Summary
- Roughly 90% of everything discussed so far counts for the mid-semester exam. What has been covered up to now is what you can think of as the mid-semester material.
- ANOVA questions are tabulated. When an analysis of variance problem is asked, the expected format is the ANOVA table: source of variation, sum of squares, degrees of freedom, mean square, F statistic, p-value — the same picture Excel and Minitab print. Learn the arithmetic: , degrees of freedom , , , and with MSE in the denominator.
- The decision rule is the p-value rule used throughout the course: → reject the null; → accept the null. The F p-value is read from the right tail, exactly like the Z, t and chi-square p-values discussed earlier.
- Calculation and output-interpretation questions. A few exam questions will be calculation-oriented: given and , compute , , the deviation columns, , , and write the estimated regression equation. A few will give you an output and ask for your inference: write the regression equation from the coefficients column (intercept and slope), state the overall significance from the ANOVA p-value, and state the individual significance from the coefficient p-values.
- If Excel is used, the exam may be framed differently. If the class works with Excel for these problems, the mid-semester exam will be framed in a different fashion; the instructions on that will be given, so nothing needs to be decided in advance.
- Reference chapters: chapter 13 for design of experiments and analysis of variance, chapter 14 for regression. For further reading on design of experiments, the book Design of Experiments by Montgomery is a good choice.
The common thread in every exam item above: the exam rewards the table or output in front of you — the ANOVA table's six columns, the coefficients column's intercept and slope, the two p-values (ANOVA for the model, coefficients for the variables). Practicing the two worked examples of this session — the Chemtech ANOVA and the trucking regression — in the tabulated format covers both styles of question.
Key Industry Applications
- Manufacturing process selection: the Chemtech filtration system example chooses among three assembly methods (A, B, C) by comparing the number of units assembled per week. The one-way ANOVA tests whether the methods differ significantly, and the random assignment of workers to methods removes personal bias — the standard industrial experiment.
- Quality improvement through variance decomposition: ANOVA splits total variation into assignable causes (the factors you control) and chance causes (error). When a single factor accounts for 70% of the variation, 30% is left to chance; industry practice is to refine the design — add factors, use interactions — so the chance component shrinks. This is the same logic behind completely randomized, randomized block, and factorial designs used in agriculture, manufacturing, and product testing.
- Predictive modeling with regression: the trucking problem uses simple linear regression (Excel output ) to relate a predictor such as miles traveled to the response, and to forecast the response by substitution — the everyday use of regression for cost and demand prediction.
- Model validation in practice: the ANOVA p-value of a regression output validates the model as a whole, and the coefficient p-values validate each predictor individually. The warning case — an overall significant model with a non-significant variable — is a routine diagnostic in data science work, and the remedy is to eliminate the weak variable and remodel.
- Software practice: Excel's Data Analysis ToolPak handles simple and multiple linear regression; Minitab prints the full ANOVA table with exact p-values; logistic and advanced regressions require R code or Python; SPSS offers predefined options, with logistic regression in its add-ins.
Where this fits in the field: this session is the bridge from hypothesis testing (single means, variances) to the two workhorses of applied statistics — ANOVA for designed experiments in engineering and R&D, and regression for prediction in operations, marketing, and finance. Both share the same underlying move: decompose the variation of the response into explained and unexplained parts, and judge the explained part against the unexplained.
ASM Lecture 7 notes · Design of Experiments, Analysis of Variance, and Regression Analysis
Sections Breakdown
What the design of experiments is about, the types of designs (completely randomized, randomized block, factorial), the principles of randomization and replication, and ANOVA as the tool for the design.
Why comparing three or more means with pairwise t tests explodes combinatorially, and the variation viewpoint that ANOVA compares between-treatment and within-treatment variability.
The full one-way ANOVA worked example: SSTR and MSTR, SSE and MSE, the F statistic, the p-value decision, and the six-column ANOVA table with SST = SSTR + SSE.
The least squares principle, the calculus derivation of the closed-form slope and intercept, and the worked trucking-data example with prediction by substitution.
The three blocks of regression output, writing the equation from the coefficients column, overall versus individual significance, and software for regression.
Exam strategy for ANOVA (tabulated answers) and regression (calculation and output-interpretation questions), reference chapters, and the p-value decision rule.
How ANOVA and regression are used in industry: manufacturing process selection, quality improvement through variance decomposition, predictive modeling, and model validation.
Exam Revision Notes
Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.
Design of Experiments
Must-know: Design of experiments plans which factors affect the outcome; the three fundamental designs (completely randomized, randomized block, factorial) rest on randomization and replication; ANOVA decomposes total variation into between-treatments (assignable) and within-treatments (chance) parts.
⚠️ Top pitfall: Believing one observation per treatment is enough — without replication a worker's individual speed is indistinguishable from the method's effect; and ignoring interactions hides the fact that combinations of factors also influence the outcome.
Self-check: If a single factor accounts for 70% of the variation, what happens to the remaining 30% when the design is refined?
Connects to: From Two Means to Many: Why ANOVA Exists; One-Way ANOVA: The Chemtech Filtration System Example
From Two Means to Many: Why ANOVA Exists
Must-know: For k population means, pairwise t tests number k(k-1)/2; ANOVA instead compares between-treatment variability (unbiased only under H0) with within-treatment variability (always unbiased) — small variability among sample means supports the null, large variability supports the alternative.
⚠️ Top pitfall: Running all pairwise t tests and reading each p-value separately: the number of tests grows as k(k-1)/2 (10 tests for five means) and every extra test adds another chance of a false rejection — the reason ANOVA compares one between vs one within number instead.
Self-check: Why is the between-treatments estimate of sigma squared inflated when the alternative hypothesis is true?
Connects to: Design of Experiments; One-Way ANOVA: The Chemtech Filtration System Example
One-Way ANOVA: The Chemtech Filtration System Example
Must-know: One-way ANOVA on the Chemtech data: grand mean 60, SSTR = 5(62-60)^2 + 5(66-60)^2 + 5(52-60)^2 = 520 with df 2, MSTR = 260; SSE = 4(27.5)+4(26.5)+4(31.0) = 340 with df 12, MSE = 28.33; F = MSTR/MSE = 9.18, p < 0.01, reject H0: mu1 = mu2 = mu3. Table identity: SST = SSTR + SSE = 860, df total = n_T - 1 = 14.
⚠️ Top pitfall: Swapping the F ratio to MSE/MSTR, or forgetting that MSE always sits in the denominator with df n_T - K; the F p-value is read from the right tail like Z, t and chi-square.
Self-check: Why is SST always equal to SSTR plus SSE, and why do the degrees of freedom add as 2 + 12 = 14?
Connects to: Design of Experiments; From Two Means to Many: Why ANOVA Exists; Simple Linear Regression
Simple Linear Regression
Must-know: Least squares minimizes sum(yi - b0 - b1xi)^2; the closed forms are b1 = sum(xi-xbar)(yi-ybar)/sum(xi-xbar)^2 and b0 = ybar - b1*xbar. For the worked data: b1 = 20/4 = 5, b0 = 20 - 10 = 10, equation y-hat = 10 + 5x, predict by substitution.
⚠️ Top pitfall: Thinking the best line is chosen by a p-value (like P > 0.5): the line is chosen by the least-error criterion, not by any probability rule; p-values only come later, for testing whether the slope is significant.
Self-check: Why does the least squares line always pass through the point (xbar, ybar)?
Connects to: One-Way ANOVA: The Chemtech Filtration System Example; Reading Regression Output: Simple and Multiple
Reading Regression Output: Simple and Multiple
Must-know: Read the equation from the coefficients column (y-hat = 1.27 + 0.067x); state overall significance from the ANOVA p-value and individual significance from the coefficient p-values. Overall-significant models can still contain individually non-significant variables — the warning case.
⚠️ Top pitfall: Treating one significant overall ANOVA p-value as proof that every predictor contributes; the coefficient p-values must be checked individually — a variable may be non-significant inside an overall-significant model.
Self-check: Which two blocks of the output answer overall significance and individual significance, and what are the two slopes in the multiple trucking equation?
Connects to: Simple Linear Regression; One-Way ANOVA: The Chemtech Filtration System Example
Exam Guidance Summary
Must-know: ANOVA answers go in the tabulated six-column format; regression answers come from the coefficients column (equation), the ANOVA p-value (overall significance), and the coefficient p-values (individual significance).
⚠️ Top pitfall: Answering an ANOVA question as scattered numbers instead of the six-column table, or forgetting that the F p-value is a right-tail p-value like Z, t and chi-square.
Self-check: Which three things does a regression-output exam question ask you to state?
Connects to: One-Way ANOVA: The Chemtech Filtration System Example; Simple Linear Regression; Reading Regression Output: Simple and Multiple
Was this lecture useful?
BitsNotes AI Assistant
Subject Notes AssistantConfigure AI Chat
Choose how to access the chatbotSigned in as
Powered by BitsNotes — 20 messages per day. No API key needed. Want unlimited access? Use "Bring Your Own Key" mode.
Sign in to use AI Chat
Get 20 free AI messages per day to ask questions about your lecture notes. Sign in with Google or GitHub — it takes 5 seconds.
Sign In to BitsNotesSwitch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.