# The General Linear Model. The Simple Linear Model Linear Regression.

## Presentation on theme: "The General Linear Model. The Simple Linear Model Linear Regression."— Presentation transcript:

The General Linear Model

The Simple Linear Model Linear Regression

Suppose that we have two variables 1. Y – the dependent variable (response variable) 2. X – the independent variable (explanatory variable, factor)

X, the independent variable may or may not be a random variable. Sometimes it is randomly observed. Sometimes specific values of X are selected

The dependent variable, Y, is assumed to be a random variable. The distribution of Y is dependent on X The object is to determine that distribution using statistical techniques. (Estimation and Hypothesis Testing)

These decisions will be based on data collected on both variable Y (the dependent variable) and X (the independent variable). Let (x 1, y 1 ), (x 2, y 2 ), …,(x n, y n ) denote n pairs of values measured on the independent variable (X) and the dependent variable (Y) The scatterplot: The graphical plot of the points: (x 1, y 1 ), (x 2, y 2 ), …,(x n, y n )

Assume that we have collected data on two variables X and Y. Let ( x 1, y 1 ) ( x 2, y 2 ) ( x 3, y 3 ) … ( x n, y n ) denote the pairs of measurements on the on two variables X and Y for n cases in a sample (or population)

1.independent random variables. 2.Normally distributed. 3.Have the common variance, . 4.The mean of y i is  i =  +  x i The assumption will be made that y 1, y 2, y 3 …, y n are Data that satisfies the assumptions above is to come from the Simple Linear Model

Each y i is assumed to be randomly generated from a normal distribution with mean  i =  +  x i and standard deviation . yiyi  +  x i  xixi

When data is correlated it falls roughly about a straight line.

The density of y i is: The joint density of y 1,y 2, …,y n is:

Estimation of the parameters the intercept  the slope  the standard deviation  (or variance  2 )

The Least Squares Line Fitting the best straight line to “linear” data

Let Y = a + b X denote an arbitrary equation of a straight line. a and b are known values. This equation can be used to predict for each value of X, the value of Y. For example, if X = x i (as for the i th case) then the predicted value of Y is:

Define the residual for each case in the sample to be: The residual sum of squares (RSS) is defined as: The residual sum of squares (RSS) is a measure of the “goodness of fit of the line Y = a + bX to the data

One choice of a and b will result in the residual sum of squares attaining a minimum. If this is the case than the line: Y = a + bX is called the Least Squares Line

To find the Least Squares estimates, a and b, we need to solve the equations: and

Note: or and

Note: or

Hence the optimal values of a and b satisfy the equations: and From the first equation we have: The second equation becomes:

Solving the second equation for b: and where and

Note: and Proof

Summary: Slope and intercept of the least squares Line and

Maximum Likelihood Estimation of the parameters the intercept  the slope  the standard deviation 

Recall The joint density of y 1,y 2, …,y n is: = the Likelihood function

the log Likelihood function To find the maximum Likelihood estimates of ,  and  we need to solve the equations:

These are the same equations for the least squares line which have solution: becomes

The third equation: becomes

Summary: Maximum Likelihood Estimates and

A computing formula for the estimate of  2 and Hence

Now Hence

It also can be shown that Thus, the maximum likelihood estimator of  2, is a biased estimator of  2. This estimator can be easily converted into an unbiased estimator of  2 by multiply by the ratio n/(n – 2)

Estimators in Linear Regression and

The major computation is :

Computing Formulae:

Application Of Statistical Theory to simple Linear Regression We will now use statistical theory to prove optimal properties of the estimators. Recall, the joint density of y 1,y 2, …,y n is:

Also and Thus all three estimators are functions of the set of complete sufficient statistics. If they are also unbiased then they are Uniform Minimum Variance Unbiased (UMVU) estimators (using the Lehmann-Scheffe theorem)

and We have already shown that s 2 is an unbiased estimator of  2. We need only show that: are unbiased estimators of  and .

Thus are unbiased estimators of  and .

Also Thus

The General Linear Model

Consider the random variable Y with 1. E[Y] =  1 X 1 +  2 X 2 +... +  p X p (alternatively E[Y] =  0 +  1 X 1 +... +  p X p, intercept included) and 2. var(Y) =  2 where  1,  2,...,  p are unknown parameters and X 1,X 2,..., X p are nonrandom variables. Assume further that Y is normally distributed.

Thus the density of Y is: f(Y|  1,  2,...,  p,  2 ) = f(Y| ,  2 )

Now suppose that n independent observations of Y, (y 1, y 2,..., y n ) are made corresponding to n sets of values of (X 1,X 2,..., X p ) - (x 11,x 12,..., x 1p ), (x 21,x 22,..., x 2p ),... (x n1,x n2,..., x np ). Then the joint density of y = (y 1, y 2,... y n ) is: f(y 1, y 2,..., y n |  1,  2,...,  p,  2 ) =

Thus is a member of the exponential family of distributions And is a Minimal Complete set of Sufficient Statistics.

Matrix-vector formulation The General Linear Model

Geometrical interpretation of the General Linear Model

Geometical interpretation of the General Linear Model

Estimation The General Linear Model

Least squares estimates of  Let

The Equations for the Least squares estimates

Written out in full These equations are called the Normal Equations

Matrix development of the Normal Equations Now The Normal Equations

Summary (the Least Squares Estimates) The Least Squares estimates satisfy The Normal Equations

Note: Some matrix properties Rank rank(AB) = min(rank(A), rank(B)) rank(A) ≤ min(# rows of A, # cols of A ) rank(A) = rank(A) Consider the normal equations

then the solution to the normal equations

Maximum Likelihood Estimation General Linear Model

The General Linear Model

The Maximum Likelihood estimates of  and  2 are the values that maximize or equivalently

This yields the system of linear equations (The Normal Equations)

yields the equation:

If [X'X] -1 exists then the normal equations have solution: and

Summary and

Comments The matrices are symmetric idempotent matrices also

Geometry of Least Squares

Example Data is collected for n = 15 cases on the variables Y (the dependent variable) and X 1, X 2, X 3 and X 4. The data and calculations are displayed on the next page:

Properties of The Maximum Likelihood Estimates Unbiasedness, Minimum Variance

Note: and Thus is an unbiased estimator of. Since is also a function of the set of complete minimal sufficient statistics, it is the UMVU estimator of. (Lehman-Scheffe)

Note: where In general

Thus: where

Thus:

Let Then Thus s 2 is an unbiased estimator of  2. Since s 2 is also a function of the set of complete minimal sufficient statistics, it is the UMVU estimator of  2.

Distributional Properties Least square Estimates (Maximum Likelidood estimates)

1.If then where A is a q × p matrix Recall ~

The General Linear Model and The Estimates

Theorem Proof

Finally and

Thus are independent. Summary

Example Data is collected for n = 15 cases on the variables Y (the dependent variable) and X 1, X 2, X 3 and X 4. The data and calculations are displayed on the next page:

Compare with SPSS output Estimates of the coefficients

The General Linear Model with an intercept

Consider the random variable Y with 1. E[Y] =  0 +  1 X 1 +  2 X 2 +... +  p X p (intercept included) and 2. var(Y) =  2 where  1,  2,...,  p are unknown parameters and X 1,X 2,..., X p are nonrandom variables. Assume further that Y is normally distributed.

The matrix formulation (intercept included) Then the model becomes Thus to include an intercept add an extra column of 1’s in the design matrix X and include the intercept in the parameter vector

The matrix formulation of the Simple Linear regression model

and Now

thus

Finally Thus

The Gauss-Markov Theorem An important result in the theory of Linear models Proves optimality of Least squares estimates in a more general setting

Assume the following model Linear Model We will not necessarily assume Normality. Consider the least squares estimate of is an unbiased linear estimator of

The Gauss-Markov Theorem Assume Consider the least squares estimate of, an unbiased linear estimator of and Let denote any other unbiased linear estimator of

Proof Now

Now is an unbiased estimator of if Also Thus

Thus The Gauss-Markov theorem states that is the Best Linear Unbiased Estimator (B.L.U.E.) of

Hypothesis testing for the GLM The General Linear Hypothesis

Testing the General Linear Hypotheses The General Linear Hypothesis H 0 :h 11  1 + h 12  2 + h 13  3 +... + h 1p  p = h 1 h 21  1 + h 22  2 + h 23  3 +... + h 2p  p = h 2... h q1  1 + h q2  2 + h q3  3 +... + h qp  p = h q where h 11  h 12, h 13,..., h qp and h 1  h 2, h 3,..., h q are known coefficients. In matrix notation

Examples 1.H 0 :  1 = 0 2.H 0 :  1 = 0,  2 = 0,  3 = 0 3.H 0 :  1 =  2

Examples 4.H 0 :  1 =  2,  3 =  4 5.H 0 :  1 = 1/2(  2 +  3 ) 6.H 0 :  1 = 1/2(  2 +  3 ),  3 = 1/3(  4 +  5 +  6 )

TheLikelihood Ratio Test The joint density of is: The likelihood function The log-likelihood function

Defn (Likelihood Ratio Test of size  ) Rejects H 0 :   against the alternative hypothesis H 1 :   . when and K is chosen so that

Note We will maximize. The Lagrange multiplier technique will be used for this purpose

We will maximize.

or finally or

Thus the equations for are Now or and

Download ppt "The General Linear Model. The Simple Linear Model Linear Regression."

Similar presentations