AP Statistics Curriculum 2007 GLM MultLin
From Socr
(→Parameter Estimation in Multilinear Regression) 
(added the partial correlation coefficient) 

Line 57:  Line 57:  
:<math> {\mathit{TSS} = \sum {\left( {y_i  \bar y} \right)^2 } = \vec y^T \vec y  \frac{1}{n}\left( { \vec y^T \vec u \vec u^T \vec y} \right) = \mathit{SSR}+ \mathit{ESS}}. </math>  :<math> {\mathit{TSS} = \sum {\left( {y_i  \bar y} \right)^2 } = \vec y^T \vec y  \frac{1}{n}\left( { \vec y^T \vec u \vec u^T \vec y} \right) = \mathit{SSR}+ \mathit{ESS}}. </math>  
+  
+  ===Partial Correlations===  
+  For a given linear model  
+  <center> <math>Y = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \cdots +\beta_p X_p + \varepsilon</math></center>  
+  the partial correlation between <math>X_1</math> and ''Y'' given a set of ''p1'' controlling variables <math>Z = \{X_2, X_3, \cdots, X_p\}</math>, denoted by <math>\rho_{YX_1Z}</math>, is the correlation between the residuals ''R''<sub>''X''</sub> and ''R''<sub>''Y''</sub> resulting from the linear regression of ''X'' with '''Z''' and that of ''Y'' with '''Z''', respectively. The firstorder partial correlation is just the difference between a correlation and the product of the removable correlations divided by the product of the coefficients of alienation of the removable correlations.  
+  
+  * Partial correlation coefficients for three variables is calculated from the pairwise simple correlations.  
+  : If, <math>Y = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \varepsilon</math>,  
+  : then the partial correlation between <math>Y</math> and <math>X_2</math>, adjusting for <math>X_1</math> is:  
+  : <math>\rho_{YX_2X_1} = \frac{\rho_{YX_2}  \rho_{YX_1}\times \rho_{X_2X_1}}{\sqrt{1 \rho_{YX_1}^2}\sqrt{1\rho_{X_2X_1}^2}}</math>  
+  
+  * In general, the sample partial correlation is  
+  :<math>\hat{\rho}_{XY\cdot\mathbf{Z}}=\frac{N\sum_{i=1}^N r_{X,i}r_{Y,i}\sum_{i=1}^N r_{X,i}\sum r_{Y,i}}  
+  {\sqrt{N\sum_{i=1}^N r_{X,i}^2\left(\sum_{i=1}^N r_{X,i}\right)^2}~\sqrt{N\sum_{i=1}^N r_{Y,i}^2\left(\sum_{i=1}^N r_{Y,i}\right)^2}},</math> where the [http://en.wikipedia.org/wiki/Partial_correlation residuals] <math>r_{X,i}</math> and <math>r_{X,i}</math> are given by:  
+  :: <math>r_{X,i} = x_i  \langle\mathbf{w}_X^*,\mathbf{z}_i \rangle</math>  
+  :: <math>r_{Y,i} = y_i  \langle\mathbf{w}_Y^*,\mathbf{z}_i \rangle</math>,  
+  :: with <math>x_i</math>, <math>y_i</math> and <math>z_i</math> denoting the random (IID) samples of some joint probability distribution over X, Y and Z.  
+  
+  ====Computing the partial correlations====  
+  The ''n''<sup>th</sup>order partial correlation ('''Z''' = ''n'') can be computed from three (''n''  1)thorder partial correlations. The ''0''<sup>th</sup>order partial correlation <math>\rho_{YX\empty}</math> is defined to be the regular [http://en.wikipedia.org/wiki/Correlation correlation coefficient] <math>\rho_{YX}</math>.  
+  
+  For any <math>Z_0 \in \mathbf{Z}</math>:  
+  :<math>\rho_{XY \mathbf{Z} } =  
+  \frac{\rho_{XY \mathbf{Z}\setminus\{Z_0\}}  \rho_{XZ_0 \mathbf{Z}\setminus\{Z_0\}}\rho_{YZ_0  \mathbf{Z}\setminus\{Z_0\}}}  
+  {\sqrt{1\rho_{XZ_0 \mathbf{Z}\setminus\{Z_0\}}^2} \sqrt{1\rho_{YZ_0  \mathbf{Z}\setminus\{Z_0\}}^2}}.</math>  
+  
+  Implementing this computation recursively yields an exponential time [http://en.wikipedia.org/wiki/Computational_complexity_theory complexity].  
+  
+  Note in the case where Z is a single variable, this reduces to:  
+  :<math>\rho_{XY  Z } =  
+  \frac{\rho_{XY}  \rho_{XZ}\rho_{YZ}}  
+  {\sqrt{1\rho_{XZ}^2} \sqrt{1\rho_{YZ}^2}}.</math>  
===Examples===  ===Examples=== 
Revision as of 04:35, 22 July 2009
Contents 
General AdvancePlacement (AP) Statistics Curriculum  Multiple Linear Regression
In the previous sections, we saw how to study the relations in bivariate designs. Now we extend that to any finite number of variables (multivariate case).
Multiple Linear Regression
We are interested in determining the linear regression, as a model, of the relationship between one dependent variable Y and many independent variables X_{i}, i = 1, ..., p. The multilinear regression model can be written as
 , where is the error term.
The coefficient β_{0} is the intercept ("constant" term) and β_{i}s are the respective parameters of the p independent variables. There are p+1 parameters to be estimated in the multilinear regression.
 Multilinear vs. nonlinear regression: This multilinear regression method is "linear" because the relation of the response (the dependent variable Y) to the independent variables is assumed to be a linear function of the parameters β_{i}. Note that multilinear regression is a linear modeling technique not because is that the graph of Y = β_{0} + βx is a straight line nor because Y is a linear function of the X variables. But the "linear" terms refers to the fact that Y can be considered a linear function of the parameters ( β_{i}), even though it is not a linear function of X. Thus, any model like

is still one of linear regression, that is, linear in x and x^{2} respectively, even though the graph on x by itself is not a straight line.
Parameter Estimation in Multilinear Regression
A multilinear regression with p coefficients and the regression intercept β_{0} and n data points (sample size), with allows construction of the following vectors and matrix with associated standard errors:
or, in vectormatrix notation
Each data point can be given as , . For n = p, standard errors of the parameter estimates could not be calculated. For n less than p, parameters could not be calculated.
 Point Estimates: The estimated values of the parameters β_{i} are given as
 Residuals: The residuals, representing the difference between the observations and the model's predictions, are required to analyse the regression and are given by:
The standard deviation, for the model is determined from
The variance in the errors is Chisquare distributed:
 Interval Estimates: The 100(1 − α)% confidence interval for the parameter, β_{i}, is computed as follows:
 ,
where t follows the Student's tdistribution with n − p − 1 degrees of freedom and denotes the value located in the i^{th} row and column of the matrix.
The regression sum of squares (or sum of squared residuals) SSR (also commonly called RSS) is given by:
 ,
where and is an n by 1 unit vector (i.e. each element is 1). Note that the terms y^{T}u and u^{T}y are both equivalent to , and so the term is equivalent to .
The error (or explained) sum of squares (ESS) is given by:
The total sum of squares (TSS) is given by
Partial Correlations
For a given linear model
the partial correlation between X_{1} and Y given a set of p1 controlling variables , denoted by , is the correlation between the residuals R_{X} and R_{Y} resulting from the linear regression of X with Z and that of Y with Z, respectively. The firstorder partial correlation is just the difference between a correlation and the product of the removable correlations divided by the product of the coefficients of alienation of the removable correlations.
 Partial correlation coefficients for three variables is calculated from the pairwise simple correlations.
 If, ,
 then the partial correlation between Y and X_{2}, adjusting for X_{1} is:
 In general, the sample partial correlation is
 where the residuals r_{X,i} and r_{X,i} are given by:
 ,
 with x_{i}, y_{i} and z_{i} denoting the random (IID) samples of some joint probability distribution over X, Y and Z.
Computing the partial correlations
The n^{th}order partial correlation (Z = n) can be computed from three (n  1)thorder partial correlations. The 0^{th}order partial correlation is defined to be the regular correlation coefficient ρ_{YX}.
For any :
Implementing this computation recursively yields an exponential time complexity.
Note in the case where Z is a single variable, this reduces to:
Examples
We now demonstrate the use of SOCR Multilinear regression applet to analyze multivariate data.
Earthquake Modeling
This is an example where the relation between variables may not be linear or explanatory. In the simple linear regression case, we were able to compute by hand some (simple) examples. Such calculations are much more involved in the multilinear regression situations. Thus we demonstrate multilinear regression only using the SOCR Multiple Regression Analysis Applet.
Use the SOCR California Earthquake dataset to investigate whether Earthquake magnitude (dependent variable) can be predicted by knowing the longitude, latitude, distance and depth of the quake. Clearly, we do not expect these predictors to have a strong effect on the earthquake magnitude, so we expect the coefficient parameters not to be significantly distinct from zero (null hypothesis). SOCR Multilinear regression applet reports this model:
Multilinear Regression on Consumer Price Index
Using the SOCR Consumer Price Index Dataset we can explore the relationship between the prices of various products and commodities. For example, regressing Gasoline on the following three predictor prices: Orange Juice, Fuel and Electricity illustrates significant effects of all these variables as significant explanatory prices (at α = 0.05) for the cost of Gasoline between 1981 and 2006.
References
 SOCR Home page: http://www.socr.ucla.edu
Translate this page: