Install free

Guides

Multiple regression in Google Sheets

Multiple regression predicts one outcome from several inputs at once and tells you the effect of each input while the others are held fixed. Example: sale prices of 16 homes (in $000) with their size, number of bedrooms, age and whether they have a garage.

ABCDE
1Sq ftBedroomsAgeGaragePrice
214503220188
317203151252
42100481314
512802350153
619503121285
72400451355
816003280203
918503181268
1022504101333
1113802400163
1220504140282
1317003251233
142600531375
1515003300198
161980491288
1723004161324

Garage is a dummy variable: 1 if the home has a garage, 0 if it does not. More on that below.

Run it with the Regression tool

  1. Open Extensions, StatPak, Data Analysis and choose Regression.
  2. Input Y range: the Price column with its header, E1:E17.
  3. Input X range: all four inputs with headers, A1:D17. The X columns must be next to each other, so keep the outcome column to the right or left of them.
  4. Tick Labels in first row and click Run.
SUMMARY OUTPUT
Regression Statistics
Multiple R0.9982905
R Square0.9965838
Adjusted R Square0.9953416
Standard Error4.672309
Observations16
ANOVA
dfSSMSFSignificance F
Regression470053.6117513.4802.24591.7625E-13
Residual11240.135221.83047
Total1570293.75
CoefficientsStandard Errort StatP-valueLower 95%Upper 95%Lower 95.0%Upper 95.0%
Intercept31.9049518.336491.7399710.1097281-8.45338672.26328-8.45338672.26328
Sq ft0.13762930.00999975213.763272.8094E-80.11561990.15963860.11561990.1596386
Bedrooms-3.7063554.834903-0.76658320.4594652-14.34796.935194-14.34796.935194
Age-1.2773290.3050412-4.1873970.001517494-1.94872-0.6059373-1.94872-0.6059373
Garage13.007254.301893.0236130.01158073.53885722.475653.53885722.47565

How to read the output

Model fit

Coefficients

Each coefficient is the change in Y for a one-unit change in that input, with all the other inputs unchanged.

P-values

The P-value for each coefficient tests whether it differs from zero. Sq ft (2.8094E-8), Age (0.001517494) and Garage (0.0115807) are below 0.05. Bedrooms (0.4594652) is not: once size, age and garage are known, the data cannot tell its effect apart from zero. Its 95% interval, -14.3479 to 6.935194, includes zero, which says the same thing.

If you drop Bedrooms (move it out of the X range so the remaining X columns stay adjacent) and run again, Adjusted R Square rises from 0.9953416 to 0.9955017. The simpler model fits slightly better once you account for the number of inputs.

Dummy variables

Regression needs numbers, so a category becomes 0/1 columns. A yes/no category needs one column, like Garage above. A category with k levels needs k - 1 columns: for three neighborhoods (North, Central, South) add a Central column and a South column, each 1 or 0. North, the level with no column, is the baseline, and each dummy's coefficient is the difference from North.

Do not add a column for every level. The columns would always add up to 1, which duplicates the intercept, and StatPak stops with an error that the X columns are linearly dependent. You can build dummies with a formula such as =IF(C2="South", 1, 0).

The same coefficients with LINEST

=LINEST(E2:E17, A2:D17, TRUE, TRUE) returns a 5 by 5 block. The first row holds the coefficients in reverse order: Garage, Age, Bedrooms, Sq ft, then the intercept. The second row holds their standard errors and the third row starts with R squared. LINEST gives no p-values or adjusted R square. Compute a p-value with =T.DIST.2T(ABS(coefficient / standard error), 11), where 11 is the residual df (16 observations minus 5 coefficients), and adjusted R square with =1 - (1 - R2) * (16 - 1) / (16 - 4 - 1).

Checks before you trust the result

Related guides