<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=R_-_Multiple_regression</id>
	<title>R - Multiple regression - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=R_-_Multiple_regression"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=R_-_Multiple_regression&amp;action=history"/>
	<updated>2026-05-13T23:41:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=R_-_Multiple_regression&amp;diff=29339&amp;oldid=prev</id>
		<title>Bernard Szlachta at 12:32, 6 March 2016</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=R_-_Multiple_regression&amp;diff=29339&amp;oldid=prev"/>
		<updated>2016-03-06T12:32:43Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Cat|Statistics}}&lt;br /&gt;
{{Cat|Intro to R}}&lt;br /&gt;
{{Cat|Forecasting}}&lt;br /&gt;
&lt;br /&gt;
== Covered Materials ==&lt;br /&gt;
* assumptions of multiple regression &lt;br /&gt;
* regression equation&lt;br /&gt;
* regression coefficient (weights)&lt;br /&gt;
* beta weight&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;R&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;r&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* partial slope&lt;br /&gt;
* sum of squares explained in a multiple regression compared to sum of squares in simple regression&lt;br /&gt;
* R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; and proportion explained&lt;br /&gt;
* R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; significance test&lt;br /&gt;
* Complete and reduced model for significance&lt;br /&gt;
&lt;br /&gt;
== Assumptions ==&lt;br /&gt;
# No assumptions are necessary for:&lt;br /&gt;
#* computing the regression coefficients&lt;br /&gt;
#* partitioning the sum of squares&lt;br /&gt;
&lt;br /&gt;
# Interpreting inferential statistics makes 3 major assumptions&lt;br /&gt;
# Moderate violations of the assumptions do not pose a serious problem for &amp;#039;&amp;#039;&amp;#039;testing the significance&amp;#039;&amp;#039;&amp;#039; of &amp;#039;&amp;#039;&amp;#039;predictor variables&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
# Even small violations of these assumptions pose problems for &amp;#039;&amp;#039;&amp;#039;confidence intervals&amp;#039;&amp;#039;&amp;#039; on predictions for specific observations&lt;br /&gt;
&lt;br /&gt;
=== Residuals are normally distributed ===&lt;br /&gt;
* residuals are the errors of prediction (differences between the actual and the predicted scores)&lt;br /&gt;
* Q-Q plot is usually to test residual normality&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 qqnorm(m$residuals)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:Rplot-qqnorm-qqplot.png|400px]]&lt;br /&gt;
&lt;br /&gt;
=== Homoscedasticity ===&lt;br /&gt;
* variances of the errors of prediction are the same for all predicted values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 plot(m$fitted.values,m$residuals)&lt;br /&gt;
 # see also plot(m)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
[[File:Rplot-homoscedasticity-plot.png|400px]]&lt;br /&gt;
* In the picture below the errors of prediction are much larger for observations with low-to-medium predicted scores than for observations with high predicted scores&lt;br /&gt;
* Confidence interval on a low predicted UGPA would underestimate the uncertainty&lt;br /&gt;
&lt;br /&gt;
=== Linearity ===&lt;br /&gt;
* relationship between each predictor and the criterion variable is linear &lt;br /&gt;
* If this assumption is not met, then the predictions may systematically overestimate the actual values for one range of values on a predictor variable and underestimate them for another.&lt;br /&gt;
* if it is know that the variables are not linear, a transformation can be use to the linear form&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
plot(UGPA ~ HSGPA)&lt;br /&gt;
plot(UGPA ~ SAT)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[File:Rplot-liniearity-assuption.png|400px]]&lt;br /&gt;
&lt;br /&gt;
== Data Used ==&lt;br /&gt;
[[File:MultipleRegression-GPA.txt]]&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
rawdata &amp;lt;- read.table(&amp;quot;http://training-course-material.com/images/4/4b/MultipleRegression-GPA.txt&amp;quot;,h=T)&lt;br /&gt;
head(rawdata)&lt;br /&gt;
&lt;br /&gt;
# Just nameing them more convinently&lt;br /&gt;
HSGPA &amp;lt;- rawdata$high_GPA&lt;br /&gt;
SAT &amp;lt;- rawdata$math_SAT + rawdata$verb_SAT&lt;br /&gt;
UGPA &amp;lt;- rawdata$univ_GPA&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Building Model ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 m &amp;lt;- lm(UGPA ~ HSGPA + SAT)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 lm(formula = UGPA ~ HSGPA + SAT)&lt;br /&gt;
 &lt;br /&gt;
 Coefficients:&lt;br /&gt;
 (Intercept)        HSGPA          SAT  &lt;br /&gt;
   0.5397848    0.5414534    0.0007918  &lt;br /&gt;
&lt;br /&gt;
== Validating Model ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 summary(m)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = UGPA ~ HSGPA + SAT)&lt;br /&gt;
 &lt;br /&gt;
 Residuals:&lt;br /&gt;
      Min       1Q   Median       3Q      Max &lt;br /&gt;
 -0.68072 -0.13667  0.01137  0.17012  0.92983  &lt;br /&gt;
 &lt;br /&gt;
 Coefficients:&lt;br /&gt;
              Estimate Std. Error t value Pr(&amp;gt;|t|)    &lt;br /&gt;
 (Intercept) 0.5397848  0.3177784   1.699   0.0924 .  &lt;br /&gt;
 HSGPA       0.5414534  0.0837479   6.465 3.53e-09 ***&lt;br /&gt;
 SAT         0.0007918  0.0003868   2.047   0.0432 *  &lt;br /&gt;
 ---&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 &lt;br /&gt;
 &lt;br /&gt;
 Residual standard error: 0.2772 on 102 degrees of freedom&lt;br /&gt;
 Multiple R-squared: 0.6232,	Adjusted R-squared: 0.6158 &lt;br /&gt;
 F-statistic: 84.35 on 2 and 102 DF,  p-value: &amp;lt; 2.2e-16&lt;br /&gt;
&lt;br /&gt;
== Interpreting the results ==&lt;br /&gt;
Regression is express my the formula:&lt;br /&gt;
 UGPA = b&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;*HSGPA + b&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt;*SAT + A&lt;br /&gt;
&lt;br /&gt;
* b&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; and b&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; are &amp;#039;&amp;#039;&amp;#039;regression coefficients&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* a regression coefficient is the slope of the linear relationship between:&lt;br /&gt;
** the criterion variable and &lt;br /&gt;
** the part of a predictor variable that is &amp;#039;&amp;#039;&amp;#039;independent of&amp;#039;&amp;#039;&amp;#039; all other predictor variables&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
* the regression coefficient for HSGPA can be computed by: &lt;br /&gt;
# first predicting HSGPA from SAT&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 m.HSGPA.SAT = lm(HSGPA ~ SAT)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = HSGPA ~ SAT)&lt;br /&gt;
 &lt;br /&gt;
 Coefficients:&lt;br /&gt;
 (Intercept)          SAT  &lt;br /&gt;
   -1.313853     0.003594   &lt;br /&gt;
# calculating the errors of prediction (m.HSGPA.SAT$residuals)&lt;br /&gt;
&lt;br /&gt;
# find the slope of the UGPA ~ m.HSGPA.SAT$residuals&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 lm(UGPA ~ m.HSGPA.SAT$residuals)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = UGPA ~ m.HSGPA.SAT$residuals)&lt;br /&gt;
 &lt;br /&gt;
 Coefficients:&lt;br /&gt;
           (Intercept)  m.HSGPA.SAT$residuals  &lt;br /&gt;
                3.1729                 0.5415&lt;br /&gt;
&lt;br /&gt;
The 0.5415 is the same value as b&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Further coefficient interpretations ===&lt;br /&gt;
The regression coefficient for HSGPA (b&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;) is the slope of the relationship between the criterion variable (UGPA) and &amp;#039;&amp;#039;&amp;#039;the part&amp;#039;&amp;#039;&amp;#039; of HSGPA that is &amp;#039;&amp;#039;&amp;#039;independent of (uncorrelated with)&amp;#039;&amp;#039;&amp;#039; the other &amp;#039;&amp;#039;&amp;#039;predictor variables &amp;#039;&amp;#039;&amp;#039; (SAT in this case). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It represents the change in the criterion variable associated with a change of one in the predictor variable when all other predictor variables &amp;#039;&amp;#039;&amp;#039;are held constant&amp;#039;&amp;#039;&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since the regression coefficient for HSGPA is 0.54, this means that, holding SAT constant, a change of one in HSGPA is associated with a change of 0.54 in UGPA&amp;#039;. &lt;br /&gt;
&lt;br /&gt;
=== Partial Slope ===&lt;br /&gt;
The slope of the relationship between the part of a predictor variable independent of other predictor variables and the criterion is its &amp;#039;&amp;#039;&amp;#039;partial slope&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thus the regression coefficient of 0.541 for HSGPA and the regression coefficient of 0.008 for SAT are partial slopes. &lt;br /&gt;
&lt;br /&gt;
Each partial slope represents the relationship between the predictor variable and the criterion holding constant all of the other predictor variables.&lt;br /&gt;
&lt;br /&gt;
== Beta Weight ==&lt;br /&gt;
* It is difficult to compare the coefficients for different variables directly because they are measured on &amp;#039;&amp;#039;&amp;#039;different scales&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* A difference of 1 in HSGPA is a fairly large difference (0.54), whereas a difference of 1 on the SAT is negligible (0.008). &lt;br /&gt;
*  standardization of the variables to standard deviation of 1 solves the problem&lt;br /&gt;
&lt;br /&gt;
* A regression weight for standardized variables is called a &amp;#039;&amp;#039;&amp;#039;beta weight&amp;#039;&amp;#039;&amp;#039; (designated as β)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 install.packages(&amp;quot;yhat&amp;quot;)&lt;br /&gt;
 library(&amp;quot;yhat&amp;quot;) &lt;br /&gt;
 &lt;br /&gt;
 r &amp;lt;- regr(m)&lt;br /&gt;
 r$Beta&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* For these data, the beta weights are 0.625 and 0.198&lt;br /&gt;
* These values represent the change in the criterion (in standard deviations) associated with a change of one standard deviation on a predictor [holding constant the value(s) on the other predictor(s)]&lt;br /&gt;
* Clearly, a change of one standard deviation on HSGPA is associated with a larger difference than a change of one standard deviation of SAT&lt;br /&gt;
&lt;br /&gt;
* In practical terms, this means that if you know a student&amp;#039;s HSGPA, knowing the student&amp;#039;s SAT does not aid the prediction of UGPA much&lt;br /&gt;
* However, if you do not know the student&amp;#039;s HSGPA, his or her SAT can aid in the prediction since the β weight in the simple regression predicting UGPA from SAT is 0.68&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 m1 &amp;lt;- lm(UGPA ~ SAT)&lt;br /&gt;
 regr(m1)$Beta_Weights&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
* the β weight in the simple regression predicting UGPA from HSGPA is 0.78&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 m1 &amp;lt;- lm(UGPA ~ HSGPA)&lt;br /&gt;
 regr(m1)$Beta_Weights&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* As is typically the case, the partial slopes are smaller than the slopes in simple regression.&lt;br /&gt;
&lt;br /&gt;
== Sum of Squares ==&lt;br /&gt;
&amp;lt;math&amp;gt;\mathrm{TSS} =  \mathrm{ESS} + \mathrm{RSS},&amp;lt;/math&amp;gt;&lt;br /&gt;
[[File:Partion of Sum of Squares.jpg]]&lt;br /&gt;
=== Total sum of squares (TSS or SSY) ===&lt;br /&gt;
: Sum of the squared difference between the actual Y and the mean of  Y		&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;y_i&amp;lt;/math&amp;gt; ith data point&lt;br /&gt;
* &amp;lt;math&amp;gt;\overline{y}&amp;lt;/math&amp;gt; the estimate of the mean&lt;br /&gt;
* &amp;lt;math&amp;gt;y_i - \overline{y}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;MATH&amp;gt; TSS  = \sum_{i=1}^n\left(y_i-\overline{y}\,\right)^2&amp;lt;/MATH&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* tells us how much variation there is in the dependent variable&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
sum((UGPA - mean(UGPA))^2)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Explained sum of squares (ESS or SSY&amp;#039;) ===&lt;br /&gt;
: Sum of the squared differences between the predicted Y and the mean of  Y, &lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\hat{y}_i=\hat{a}+\hat{b_1}x_{1i} + \hat{b_2}x_{2i} + \cdots \,  &amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;\text{ESS} = \sum_{i=1}^n \left(\hat{y}_i - \bar{y}\right)^2.&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;math&amp;gt;\hat{y}&amp;lt;/math&amp;gt; = Yhat&lt;br /&gt;
* ESS tells us how much of the variation in the dependent variable our model explained&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 sum((m$fitted.values - mean(UGPA))^2)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Residual sum of squares (RSS or SSE) ===&lt;br /&gt;
: Sum of the squared differences between the actual Y and the predicted Y&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
RSS = \sum_{i=1}^n (y_i - \hat{y}_i)^2 &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
= \sum_{i=1}^n (y_i - f(x_i))^2&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
= \sum_{i=1}^n (\epsilon_i)^2 &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;&lt;br /&gt;
= \sum_{i=1}^n (y_i - (\alpha + \beta x_i))^2 &lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* it is how much of the variation in the dependent variable our model did not explain&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
sum((UGPA - m$fitted.values)^2)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Calculating sum of squares in R ===&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 TSS = sum((UGPA - mean(UGPA))^2)&lt;br /&gt;
 ESS = sum((m$fitted.values - mean(UGPA))^2)&lt;br /&gt;
 RSS = sum((UGPA - m$fitted.values)^2)&lt;br /&gt;
 # TODO: add aov function method&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;gt; TSS&lt;br /&gt;
 [1] 20.79814&lt;br /&gt;
 &amp;gt; ESS&lt;br /&gt;
 [1] 12.96135&lt;br /&gt;
 &amp;gt; RSS&lt;br /&gt;
 [1] 7.836789&lt;br /&gt;
&lt;br /&gt;
== Multiple Correlation and Proportion Explained ==&lt;br /&gt;
 Proportion Explained = SSY&amp;#039;/SSY = R&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 ProportionExplained = ESS/TSS&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
 ProportionExplained&lt;br /&gt;
 [1] 0.6231977&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 m &amp;lt;- lm(UGPA ~ HSGPA + SAT)&lt;br /&gt;
 summary(m)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
 Call:&lt;br /&gt;
 lm(formula = UGPA ~ HSGPA + SAT)&lt;br /&gt;
 &lt;br /&gt;
 Residuals:&lt;br /&gt;
      Min       1Q   Median       3Q      Max &lt;br /&gt;
 -0.68072 -0.13667  0.01137  0.17012  0.92983  &lt;br /&gt;
 &lt;br /&gt;
 Coefficients:&lt;br /&gt;
              Estimate Std. Error t value Pr(&amp;gt;|t|)    &lt;br /&gt;
 (Intercept) 0.5397848  0.3177784   1.699   0.0924 .  &lt;br /&gt;
 HSGPA       0.5414534  0.0837479   6.465 3.53e-09 ***&lt;br /&gt;
 SAT         0.0007918  0.0003868   2.047   0.0432 *  &lt;br /&gt;
 ---&lt;br /&gt;
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 &lt;br /&gt;
 &lt;br /&gt;
 Residual standard error: 0.2772 on 102 degrees of freedom&lt;br /&gt;
 Multiple R-squared: 0.6232,	Adjusted R-squared: 0.6158 &lt;br /&gt;
 F-statistic: 84.35 on 2 and 102 DF,  p-value: &amp;lt; 2.2e-16&lt;br /&gt;
&lt;br /&gt;
== Confounding ==&lt;br /&gt;
* the sum of squares explained  (ESS) for these data is 12.96&lt;br /&gt;
* How is this value divided between HSGPA and SAT?&lt;br /&gt;
* it is not the same as prediction of UGPA in separate simple regressions for HSGPA and SAT&lt;br /&gt;
&lt;br /&gt;
 Predictors	Sum of Squares&lt;br /&gt;
 HSGPA	        12.64 (simple regression)&lt;br /&gt;
 SAT	        9.75  (simple regression)&lt;br /&gt;
 HSGPA and SAT	12.96 (multiple regression)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 m &amp;lt;- lm(UGPA ~ HSGPA + SAT)&lt;br /&gt;
 ESS = sum((m$fitted.values - mean(UGPA))^2)&lt;br /&gt;
 # SAT has bee left out&lt;br /&gt;
 m.hsgpa &amp;lt;- lm(UGPA ~  HSGPA)&lt;br /&gt;
 ess.hsgpa &amp;lt;- sum((m.hsgpa$fitted.values - mean(UGPA))^2)&lt;br /&gt;
 # HSGPA has been left out&lt;br /&gt;
 m.sat &amp;lt;- lm(UGPA ~  SAT)&lt;br /&gt;
 ess.sat &amp;lt;- sum((m.sat$fitted.values - mean(UGPA))^2)&lt;br /&gt;
 ess.hsgpa # 12.63942&lt;br /&gt;
 ess.sat   # 9.749823&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* If the sum of ESS in simple regressions is higher than the ESS in multiple regression, it means the &amp;#039;&amp;#039;&amp;#039;predictors are correlated (r = .78)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Much of the variance in UGPA is &amp;#039;&amp;#039;&amp;#039;confounded&amp;#039;&amp;#039;&amp;#039; between HSGPA and SAT&lt;br /&gt;
* The variance in UGPA could be explained by either HSGPA or SAT&lt;br /&gt;
* is counted twice if the sums of squares for HSGPA and SAT are simply added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Proportion of variable explained ===&lt;br /&gt;
 Source	                       SS   Proportion&lt;br /&gt;
 HSGPA (unique)	             3.21   0.15&lt;br /&gt;
 SAT (unique)	             0.32   0.02&lt;br /&gt;
 HSGPA and SAT (Confounded)   9.43   0.45&lt;br /&gt;
 Error	                     7.84   0.38&lt;br /&gt;
 Total	                    20.80  1.00&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;rsplus&amp;quot;&amp;gt;&lt;br /&gt;
 HSGPA.UNIQUE &amp;lt;- ESS - ess.sat&lt;br /&gt;
 HSGPA.UNIQUE # 3.211531&lt;br /&gt;
 SAT.UNIQUE   &amp;lt;- ESS - ess.hsgpa&lt;br /&gt;
 SAT.UNIQUE    # 0.3219346&lt;br /&gt;
 HSGPA.SAT.Confounded = ESS - (HSGPA.UNIQUE + SAT.UNIQUE)&lt;br /&gt;
 HSGPA.SAT.Confounded # 9.427889&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Bernard Szlachta</name></author>
	</entry>
</feed>