Using Regression Analysis to Predict Business Outcomes

UPI Study › Courses › Marketing Research › Free lessons › Lesson 12.4 Free lesson

Using Regression Analysis to Predict Business Outcomes

Marketing Research · Chapter 12: Correlation, Regression, and Advanced Data AnalysisSection 12.4 · lesson 87 of 10112 min · free to watch

← How to Build a Correlation Matrix in ExcelNext lesson: Bivariate Analysis: Examining the Relationship Between Two Marketing Variables →

Earn 3 college credits for Marketing ResearchRecommended for credit by NCCRS · Marketing 300 · self-paced · one payment, lifetime access

In this lesson

Fit a least squares line, predict sales and check the residuals.

  • Write a simple regression line and compute its slope and intercept
  • Use the line to predict and explain why extrapolation is risky
  • Read residuals for size and pattern to judge the fit
  • Describe what multiple regression adds by holding other predictors fixed

Free study notes

Get this lesson's notes by email

The key points and 4 practice questions with answers, in your inbox. One email, free.

One email. Unsubscribe in one click.

Transcript

Everything said in the video, section by section (1,633 words). Read along, or search it.

Opening Example

Ice Cream Cones and Hot Days

You scoop ice cream every summer. And you notice a pattern. On a 25 degree day, you sell about 80 cones. On a 30 degree day, about 110.

Without being told, you start guessing. "Tomorrow will be 28 degrees. That means around 98 cones." That guess is a simple regression, done in your head.

Take Fernway Snacks, a composite case built for teaching. Leo wants the same kind of guess, for bars. "If we spend 6 thousand dollars on ads next week, what sales should we plan for?"

Correlation, from lesson 12.1, says the two move together. But it cannot give Leo a number of bars. Regression can. It gives him the line he can use to predict.

Learning Goals

Slope, Intercept, Prediction and Residuals

By the end of this lesson, you will write a simple regression line, y equals a plus b x, and compute its slope and intercept. You will use the line to predict, and explain why predicting outside the data is risky. And you will read residuals, and describe in plain words what multiple regression adds.

Core Idea

The Least Squares Line

First: drawing the best line through the dots. Simple linear regression fits a straight line to a scatterplot. Why? So you can predict one variable from another.

The variable you predict is the outcome, y. It is also called the dependent variable. The variable you predict from is the predictor, x. It is also called the independent variable. You met those terms in lesson 6.2.

The line is written y equals a plus b x. It has two parts. And each one has a plain meaning.

B, the slope, is how much y changes when x goes up by one unit. A, the intercept, is the predicted y when x is zero. It is where the line crosses the vertical axis.

But many lines could pass through a cloud of dots. Which one do we use? The line that makes the sum of the squared misses as small as possible. Those are the same squared misses you met in lesson 12.2. That line is called the least squares line.

Fernway's Line

Sales Rise 4.70 per Step of Ad Spend

Picture Fernway's ten weeks, with the navy line running through them. It crosses the vertical axis at 30.15. And for every one step of run, it rises 4.70. The line is y equals 30.15 plus 4.70 times x.

Worked Calculation

Computing the Slope and Intercept by Hand

Next: computing the slope and the intercept. First, in words. The slope is the sum of the products of each variable's distance from its mean. That is the same sum used for r, in lesson 12.1. Then divide by the sum of the squared distances of x from its mean.

The intercept is the mean of y, minus the slope times the mean of ad spend. That pins the line in place. It passes right through the middle of the data, the point where both means meet.

Now, by hand. The sum of products, from lesson 12.1, is 223.8. The sum of squares for x is 47.6. So b is 223.8, over 47.6. That is 4.7017.

Then a is the mean of sales, 54.6, minus 4.7017 times the mean of ad spend, 5.2. That gives 30.1513.

So the line is sales equals 30.15, plus 4.70 times ad spend. Python's fit matches these values to four decimal places. And R squared is 0.9195, just as in lesson 12.2.

Interpretation

What the Slope and Intercept Mean

What does it mean? Read the slope first. Each extra thousand dollars of ad spend goes with about 4.70 thousand more bars in a week, in this dataset. That is the practical number for Leo. It tells him what each step of spending has gone with.

Now the intercept. It is the line's anchor at zero ad spend: 30.15 thousand bars. But no week had zero ad spend. The lowest was 2. So do not lean on it as a real forecast. It is a mathematical anchor, not a promise about a week with no ads.

A pro tip. Excel can do all this, without code. The SLOPE function returns b. The INTERCEPT function returns a. Give each one the y values first, and the x values second. The RSQ function gives R squared. And the ToolPak, from lesson 12.3, also has a Regression tool, that writes a full table.

Prediction

Interpolation Inside the Data Range

Next: predicting, and the danger of extrapolating. To predict, put an x into the line. Try 4 thousand dollars of ads. 30.15, plus 4.70 times 4. That gives 48.96 thousand bars.

For 6 thousand dollars, the answer to Leo's question, the line gives 58.36 thousand bars. Both of these are interpolations. That means predictions inside the range of x values the line was built on. That range runs from 2 to 9.

Extrapolation means predicting outside that range. And it is where lines get people into trouble. The line does not know that ovens have limits. It does not know that shoppers get tired of ads. It just keeps going, straight up, forever.

Extrapolation Risk

When the Line Outruns the Ovens

At 20 thousand dollars, the line says 124.18 thousand bars. But Fernway's ovens can bake only 100 thousand bars a week. That limit is invented, for teaching. Still, it shows the point. The line has predicted more bars than the ovens could ever make. So the prediction cannot be right.

Inside the range of the data, the line has weeks to lean on. Outside it, the line is guessing in the dark. Every straight line breaks somewhere. Data from inside the range cannot show you where.

Here is a common mistake. Someone reads a prediction as a promise. Or as a cause. "Spend 6 thousand, and sales will be 58.36." That ignores the miss of a few thousand bars that every week shows.

Common Mistake

Fitted Lines Do Not Show Cause

And a regression line fitted to observed data shows how things went together. Not that raising spend will raise sales. For that, you need an experiment, as lesson 6.5 explained. So quote a prediction as a typical value for a similar week, not a guarantee.

Residuals

Actual Minus Predicted for Week 7

Next: residuals. How far off is the line? A residual is the actual value, minus the predicted value, for one week.

Take week 7. It spent 6 thousand dollars, and sold 63 thousand bars. The line predicted 58.36. So its residual is 63 minus 58.36. That is +4.64. The real week beat the line by more than four thousand bars.

Here is a neat fact. The least squares line is built so that the residuals add up to zero. The output shows it. The sum prints as 0.0000. So the positive misses and the negative misses always balance.

What matters, then, is their size, and their shape. A good fit has small residuals, scattered at random above and below zero. A positive residual means actual sales beat the line. One below zero means the week fell short of it.

Residual Check

Small Random Misses Signal a Good Fit

For Fernway, the bars add up to zero, and no clear pattern shows. That is what a good straight-line fit looks like. But watch for warning signs. A curve, or a funnel, in the residuals warns that a straight line is the wrong model.

The biggest miss is week 7, at 4.64 thousand bars. Weekly sales run between 40 and 71 thousand. For Leo, a forecast from this line would typically be off by a few thousand bars. That is useful accuracy, for planning production.

Multiple Regression

Several Predictors Held Fixed

Next: multiple regression, at concept level. Sales depend on more than ads. Price matters. Shelf space matters. Multiple regression uses several predictors at once.

The line becomes: sales equals a, plus b one times price, plus b two times ad spend, plus b three times shelf space. Each slope tells you the change in sales for one more unit of that predictor, with the others held fixed.

That "held fixed" is its great strength. It separates overlapping variables. Remember ad spend and shelf space? They had r equals +0.33, in lesson 12.3. Stores with big ad budgets also tended to have more shelf space. Multiple regression pulls their effects apart.

Here are the ten stores from lesson 12.3, fitted by a computer. Price gets a slope of -15.61. Ad spend gets +4.03. And shelf space gets +1.34. Sales here are in hundreds of bars.

Interpretation

Adding Predictors Lifts R Squared

What does it mean? With price and shelf space in the model, one more thousand dollars of ad spend goes with about 4.03 more hundred bars. A price one dollar higher goes with about 15.61 fewer.

And R squared climbs. With ad spend alone, it is 0.585. With all three together, it is 0.961.

Computers do the arithmetic. The skill is in choosing predictors, and checking the results. But be careful. With only ten stores and three predictors, treat these numbers as an illustration of the idea, not as findings. With real data, you would want many more than ten stores. A model with few observations and several predictors can fit by luck. How such models are used in practice returns in lesson 12.9.

Back at the office, Leo asks Grace for next week's sales plan, with a 6 thousand dollar ad budget. Grace uses the line. About 58 thousand bars.

Office Scene

Test Before Betting on Bigger Budgets

Then Leo asks about 20 thousand dollars. "That is far outside anything we have tried," Grace says. "The line would say 124. But the ovens stop at 100, and I have no data there. Let us test 10 thousand first. Then refit the line with the new weeks."

Key Takeaways

Predict Inside the Range of the Data

Key takeaways. Simple regression fits y equals a plus b x, by least squares. Here, sales equals 30.15, plus 4.70 times ad spend. Use it to predict inside the range of the data. Check the residuals, for size and pattern. And never trust it far outside the data. Multiple regression uses several predictors. It gives each one's effect, with the others held fixed.

Next, in lesson 12.5, you will learn how to choose the right technique, for any pair of variables. This lesson was made by UPI Study.

About Marketing Research at UPI Study

Marketing Research (Marketing 300) is a self-paced online course of 101 video lessons in 13 chapters, from consumer behavior, segmentation and the research process to qualitative methods, surveys and sampling, measurement, experiments, secondary and syndicated data, descriptive statistics, hypothesis tests, correlation and regression, research ethics and reports. It carries a NCCRS credit recommendation for 3 semester credits.

Every lesson transcript is free on pages like this one, and the videos are free with a free UPI Study account. Enrolling adds a practice quiz after each lesson, the graded work and final exam that earn the credit, lifetime access, and an official transcript on completion. UPI Study has helped over 130,000 students with college credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Compare: Principles of Marketing vs Marketing Research

Why take it here

Why students take Marketing Research with UPI Study

Turn customer questions into evidenceMarketing Research teaches how companies find out what customers want: defining the problem, interviews and focus groups, survey design and sampling, measurement scales, experiments, secondary and syndicated data, and data analysis from descriptive statistics to hypothesis tests, cross-tabs and regression, ending with the research report. It suits marketing and business degrees.
Credit at a fraction of the priceThe same 3 credits can cost $750 or more at a US college. Here it is one payment, self-paced, with lifetime access.
Finish your degree soonerTransfer credits reduce the courses you still owe, so you can graduate earlier or lighten a heavy semester.
Strengthen an applicationA completed college-level course on an official transcript shows admissions and scholarship committees you can do the work.
Study on your own scheduleNo start dates, no deadlines. Watch the lessons, practice, and take the final when you are ready.
130,000+students helped with college creditsACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Where the credit goes

Universities that work with NCCRS

Marketing Research carries a NCCRS credit recommendation. These universities work with NCCRS; some are UPI Study's signed partners. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.

Find my college → Not listed? Ask Athena in the corner of this page, or book a 15-minute call.

FAQ

Questions students ask us

About Using Regression Analysis to Predict Business Outcomes

What do the slope and intercept mean in a simple regression line?
In y = a + bx, the slope b is how much the predicted outcome changes when the predictor rises by one unit, and the intercept a is the predicted outcome when x is zero. For sales = 30.15 + 4.70 times ad spend, each extra thousand dollars of ads goes with about 4.70 thousand more bars. The intercept is only an anchor when no data sit near zero.
How do you calculate the least squares slope and intercept by hand?
The slope equals the sum of the products of each variable's deviations from its mean, divided by the sum of squared deviations of x. The intercept equals the mean of y minus the slope times the mean of x. With a sum of products of 223.8 and an x sum of squares of 47.6, the slope is 4.7017, and 54.6 minus 4.7017 times 5.2 gives 30.1513.
Why is extrapolation risky in regression analysis?
Extrapolation means predicting outside the range of x values used to fit the line, where no data show whether the straight-line pattern still holds. A line fitted to weekly ad budgets of $2,000 to $9,000 predicts 124.18 thousand bars at $20,000, even if production could never reach that level. Capacity limits and ad fatigue bend relationships, so test new levels before relying on such forecasts.
What is a residual in regression and what should residuals look like?
A residual is the actual value minus the value the line predicts for one observation. If a week sold 63 thousand bars and the line predicted 58.36 thousand, the residual is +4.64. Least squares residuals add up to zero, so judge their size and pattern instead. A good fit shows small residuals scattered randomly around zero; a curve or funnel suggests a straight line is the wrong model.

About the Marketing Research course

How many college credits is Marketing Research?
Marketing Research (Marketing 300) carries a NCCRS credit recommendation for 3 semester credits. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities.
How much does Marketing Research cost and what is included?
$250, paid once, with lifetime access: all 101 video lessons, a practice quiz after each, the graded work and final exam, and an official transcript when you finish. Students who want several courses choose UPI Study PRO instead.
Which universities accept UPI Study credits?
UPI Study has signed partner agreements with universities such as Thomas Edison State University, University of the People and Charter Oak State College, and works with universities such as Penn State, SNHU and SUNY. ACE and NCCRS have over 2,100 cooperating colleges that will consider accepting credits; the final decision is with the universities. Use "Find my college" on this page to check yours.
How long does Marketing Research take?
It is self-paced with no deadlines. The 101 lessons total about 19 hours of video; most students add reading and practice time and finish in a few weeks to a few months, on their own schedule.
How are the exams done?
Quizzes and assignments are online in the course. The final exam is taken online with proctoring; a person on the UPI Study team checks assignments, usually within two days.
How do my credits reach my college?
When the course shows 100% complete, request the official transcript from your dashboard. It is sent to the college you name, and you can send it to more than one. Check your college first with "Find my college" on this page, or ask Athena.

Ready for the full course? Earn 3 credits in Marketing Research.

101 video lessons, a quiz after each one, and the graded work that earns the credit. Recommended for credit by NCCRS.

Updated

Marketing Research
3 credits · NCCRS
Enroll →