Chapter 2. Simple Workflow and Passive Debugging

Linear Regression

For most of this book, we’ll be working on applications that do linear regression, a simple but informative statistic. Suppose that you have a series of data pairs, such as the quarterly sales figures for a particular department, shown in Table 2.1.

Table 2.1. Quarterly Sales Figures for a Hypothetical Company (millions of dollars)

Quarter

Sales

1

107.5

2

110.3

3

114.5

4

116.0

5

119.3

6

122.4

A regression line is the straight line that passes nearest all the data points (see Figure 2.1). The formula for such a line is y = mx + b, or the sales (y) for a given quarter (x) rise at a quarterly rate (m) from a base at “quarter zero” (b). We have the x and y values; we’d like to determine m and b.

Figure 2.1. The ...

Get Step into Xcode Mac OS X Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.