Docsity

Understanding Linear Regression: Variables, Model Equation, and Estimation, Schemes and Mind Maps of Mathematics

Partial preview of the text

Download Understanding Linear Regression: Variables, Model Equation, and Estimation and more Schemes and Mind Maps Mathematics in PDF only on Docsity!

Lecture 9: Linear Regression

Goals

  • Linear regression in R
    • Estimating parameters and hypothesis testing with linear models
    • Develop basic concepts of linear regression from a probabilistic framework

Regression Lingo Y = X 1 + X 2 + X 3

Dependent Variable Response Variable Outcome Variable^ Independent Variable Explanatory Variable Predictor Variable

  • Suppose we want to model the dependent variable Y in terms of three predictors, XWhy Linear Regression? 1 , X 2 , X 3
  • Typically will not have enough data to try and directly estimate f^ Y =^ f (X^1 , X^2 , X^3 )
  • Therefore, we restricted form, such as linear (^) Y = X usually have to 1 + X (^) 2 assume that it has some + X 3

A Linear Probabilistic Model

!!^ y^ "^0 x

!^ y^ =^ "^0 +^ "^1 x^ +^ #

  • Definition: There exists any fixed value of the independent variable x, the dependent variable is related to x through the model equation parameters!! "! 0 , " 1 , and " , such that for^2
    • "^ is a rv assumed to be N(0,^ #^2 ) !^ y^ =^ "^0 +^ "^1 x

True Regression Line !^ "^1!!^ "^2

" 3

  • The x, the variable Y differs amount expected value of Y is a linear function of X, but for fixedImplications from its expected value by a random
    • Formally, variable x, then let x* denote a particular value of the independent our linear probabilistic model says:
!!^ E^ V^ (( YY^ ||^ xx ))^ ==^ μ^ "Y|^ Y|^2 xx**^ ==^ mean value ofvariance of^ Y^^ when Y^ when^ x^ is^ x^^ x is^ *^ x^ *

Suppose the relationship between the independent variable height (x) and dependent variable weight (y) is described by a simple linear regression model with true regression lineOne More Example y = 7.5 + 0.5x and

  • Q 2 : If x = 20 what is the expected value of Y? !^ •^ Q^3 : If x = 20 what is P(Y > 22)?^ μ Y^ |x^ =^20 =^ 7.5^ +^ 0.5(20)^ =^ 17.
  • Q 1 : What is the interpretation of The expected change in in weight! height! "associated with a 1 = 0.5?^ "^ =^3 1 -unit increase P (Y > 22 | x = 20) = P^ " # $ 22 - 3 17.5% & ' = 1 ( )(1.5) = 0.
  • Point estimates of squaresEstimating Model Parameters and are obtained by the principle of least !!!^ f^^ "(^ ˆ^ "^00 ,^ "^1 )^ =^ "^ ˆ^ $^ i^1 =^ n^1 [^ yi^ #^ (^ "^0 +^ "^1 xi^ )]^2
  • !"ˆ 0 = y #! "ˆ 1 x^ y^ "!^0^ x

Residuals Are Useful!

!^ SSE^ =^ "^ i =^ n^1 ( ei )^2 =^ "^ i =^ n^1 ( yi #^ y ˆ^ i^ )^2

  • • TheyWhich in turn allows us to estimate allow us to calculate the error sum of squares (SSE): :
    • As well as an important statistic referred to as the coefficient of determination:!^ "^ ˆ^2 =^^ nSSE^ !#^2 "^2 !^ r^2 =^1 "^ SSE^ SST!^ SST^ =^^ i =^1 ( yi^ "^ y^ )^2 #^ n
  • Extension of the simple linear regression model to more independent variablesMultiple Linear Regression two or -! Partial Regression Coefficients: dependent variable when increasing the variable by^ y^ 1 = unit,^ "^0 + holding all other predictors^ "^1 x^1 +^ "^2 x^2 β+i ...≡ +effect on the^ " n i^ x th n^ independent+^ #
constant
Expression = Baseline + Age + Tissue + Sex + Error
  • • Previous coding would result inSolution is to set up a series of dummy variable. In generalCategorical Independent Variables colinearity
for k levels you need k- x x 12 == 1 dummy variables 101 if AAotherwiseif AG

AA^0 otherwise GG^ AG^ x^1001 x^1002

  • Hypothesis Testing: Model Utility Test (orThe first thing we want to know after fitting a model is whether^ Omnibus Test) any of the independent variables (X the dependent variable (Y): ’s) are significantly related to !

H H f (^0) A= :: ( 1 "At least one$ R (^1) R = 2 2 " (^) ) 2 • = (^) n ... $ =( kk " " (^1) + k # (^) 1 = (^) ) 0 0 !^ Rejection Region^ :^ F^ ", k , n #( k^ +1)

Equivalent • We can also frame this in our now familiar ANOVA framework ANOVA Formulation of Omnibus Test

Rejection Region : F ", k , n #( k +1)

  • partition total variation into two components: variation) and SSR (variation explained by linear model) SSE (unexplained RegressionTotalError n-1 n-2 k Source of Variation df Sum of Squares MS F !!!^ SSE^ SSR^ SST^ ===^ #^ #^ #((( y^ yy ˆ i^ i^ i^ """!^!^ y ˆ yy^ i^ ))^ )^222^ n^ SSE^ SSR^ "^ k^2!^ MS^ MSRE
  • F A powerful tool in compare two models^ Test^ For Subsets of Independent Variables multiple regression analyses is the ability to
    • For instance say we want to compare:
!^ •^ Again, another example of ANOVA:! SSE reduced model withR = error sum of squares for^ Reduced Model^ Full Model predictors^ ::^ yy^ ==^ "^ "^00 ++^ "^ " f^11 xx =^11 (++ SSE SSE^ "^ "^22 xxR^22 F^^ ++" /([^ # " SSE^3 n^ x^3 "^ + F (^ ") k /(^4^ + xk^4 1^ "+)] # l )

SSE full model withF = error sum of squares for! k predictors^ l