Interpretation, Prediction and Confidence Intervals

Similar documents
Transformations. Merlise Clyde. Readings: Gelman & Hill Ch 2-4, ALR 8-9

Transformations. Merlise Clyde. Readings: Gelman & Hill Ch 2-4

Sampling Distributions

Ch 2: Simple Linear Regression

Sampling Distributions

Linear models and their mathematical foundations: Simple linear regression

Distribution Assumptions

STAT 215 Confidence and Prediction Intervals in Regression

Ch 3: Multiple Linear Regression

Lecture 6 Multiple Linear Regression, cont.

Simple and Multiple Linear Regression

Applied Regression Analysis

Regression Review. Statistics 149. Spring Copyright c 2006 by Mark E. Irwin

Simple Linear Regression

Stat 529 (Winter 2011) A simple linear regression (SLR) case study. Mammals brain weights and body weights

STAT420 Midterm Exam. University of Illinois Urbana-Champaign October 19 (Friday), :00 4:15p. SOLUTIONS (Yellow)

Applied Regression. Applied Regression. Chapter 2 Simple Linear Regression. Hongcheng Li. April, 6, 2013

No other aids are allowed. For example you are not allowed to have any other textbook or past exams.

Simple Linear Regression

Problems. Suppose both models are fitted to the same data. Show that SS Res, A SS Res, B

Homework 9 Sample Solution

UNIVERSITY OF MASSACHUSETTS. Department of Mathematics and Statistics. Basic Exam - Applied Statistics. Tuesday, January 17, 2017

Lecture 16: Again on Regression

Inference for Regression

Section 4.6 Simple Linear Regression

Handout 4: Simple Linear Regression

Figure 1: The fitted line using the shipment route-number of ampules data. STAT5044: Regression and ANOVA The Solution of Homework #2 Inyoung Kim

Simple Linear Regression

F3: Classical normal linear rgression model distribution, interval estimation and hypothesis testing

The linear model is the most fundamental of all serious statistical models encompassing:

Chapter 16: Understanding Relationships Numerical Data

Analytics 512: Homework # 2 Tim Ahn February 9, 2016

1 Multiple Regression

Lecture 2. Simple linear regression

Multiple Predictor Variables: ANOVA

AMS 315/576 Lecture Notes. Chapter 11. Simple Linear Regression

Statistics 112 Simple Linear Regression Fuel Consumption Example March 1, 2004 E. Bura

ST430 Exam 2 Solutions

How to mathematically model a linear relationship and make predictions.

Lecture 1: Linear Models and Applications

ANOVA Situation The F Statistic Multiple Comparisons. 1-Way ANOVA MATH 143. Department of Mathematics and Statistics Calvin College

Matrix Approach to Simple Linear Regression: An Overview

Overview Scatter Plot Example

Categorical Predictor Variables

Probability and Statistics Notes

1-Way ANOVA MATH 143. Spring Department of Mathematics and Statistics Calvin College

Applied Regression Analysis. Section 4: Diagnostics and Transformations

UNIVERSITY OF TORONTO SCARBOROUGH Department of Computer and Mathematical Sciences Midterm Test, October 2013

STAT 511. Lecture : Simple linear regression Devore: Section Prof. Michael Levine. December 3, Levine STAT 511

Coefficient of Determination

Topic 14: Inference in Multiple Regression

R 2 and F -Tests and ANOVA

STAT 4385 Topic 03: Simple Linear Regression

AMS-207: Bayesian Statistics

Inference. ME104: Linear Regression Analysis Kenneth Benoit. August 15, August 15, 2012 Lecture 3 Multiple linear regression 1 1 / 58

ST430 Exam 1 with Answers

BANA 7046 Data Mining I Lecture 2. Linear Regression, Model Assessment, and Cross-validation 1

Lectures on Simple Linear Regression Stat 431, Summer 2012

Exam Applied Statistical Regression. Good Luck!

Lecture 4 Multiple linear regression

Regression. Marc H. Mehlman University of New Haven

Chapter 14. Linear least squares

1 Forecasting House Starts

Binary Regression. GH Chapter 5, ISL Chapter 4. January 31, 2017

Bayesian Linear Models

Regression Analysis. Regression: Methodology for studying the relationship among two or more variables

Multiple Predictor Variables: ANOVA

Regression on Faithful with Section 9.3 content

Regression: Main Ideas Setting: Quantitative outcome with a quantitative explanatory variable. Example, cont.

Bayesian Linear Models

NATIONAL UNIVERSITY OF SINGAPORE EXAMINATION. ST4233 Linear Models: Solutions. (Semester I: ) November/December, 2007 Time Allowed : 2 Hours

Lecture 3: Inference in SLR

STAT 540: Data Analysis and Regression

PART I. (a) Describe all the assumptions for a normal error regression model with one predictor variable,

13 Simple Linear Regression

Measuring the fit of the model - SSR

36-309/749 Experimental Design for Behavioral and Social Sciences. Sep. 22, 2015 Lecture 4: Linear Regression

Correlation and Regression

MAT2377. Rafa l Kulik. Version 2015/November/26. Rafa l Kulik

lm statistics Chris Parrish

Bayesian Linear Regression

Chapter 3: Multiple Regression. August 14, 2018

Multiple Linear Regression (solutions to exercises)

Estimated Simple Regression Equation

Simple Linear Regression

Chapter 2 Multiple Regression I (Part 1)

Regression diagnostics

Linear Regression Model. Badr Missaoui

Matrices and vectors A matrix is a rectangular array of numbers. Here s an example: A =

Chapter 12: Multiple Linear Regression

Introduction and Single Predictor Regression. Correlation

Data Mining Stat 588

Confidence Intervals, Testing and ANOVA Summary

Stat 579: Generalized Linear Models and Extensions

2. A Review of Some Key Linear Models Results. Copyright c 2018 Dan Nettleton (Iowa State University) 2. Statistics / 28

Linear Modelling: Simple Regression

Math 141. Lecture 16: More than one group. Albyn Jones 1. jones/courses/ Library 304. Albyn Jones Math 141

Multiple Linear Regression

Poisson Regression. Gelman & Hill Chapter 6. February 6, 2017

Multivariate Linear Regression Models

Transcription:

Interpretation, Prediction and Confidence Intervals Merlise Clyde September 15, 2017

Last Class Model for log brain weight as a function of log body weight Nested Model Comparison using ANOVA led to model with parallel lines

Last Class Model for log brain weight as a function of log body weight Nested Model Comparison using ANOVA led to model with parallel lines Why does model with the 3 indicator variable contain the other models? log(brain) = β 0 +log(body)β 1 +Dino.Tβ 2 +Dino.Bβ 3 +Dino.Dβ 4 +ɛ

Check residuals Residuals vs Fitted Normal Q Q Residuals 1.0 0.0 1.0 2.0 Human Rhesus monkey Chimpanzee Standardized residuals 1 0 1 2 3 Human Rhesus monkey Chimpanzee 0 2 4 6 8 2 1 0 1 2 Fitted values Theoretical Quantiles Standardized residuals 0.0 0.5 1.0 1.5 Scale Location Human Rhesus monkey Chimpanzee Standardized residuals 1 0 1 2 3 Human Cook's distance Residuals vs Leverage Triceratops Brachiosaurus 1 0.5 0.5 0 2 4 6 8 Fitted values 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 Leverage

Coefficient Summaries Estimate Std. Error t value Pr(> t ) (Intercept) 2.16 0.19 11.09 0.00 log(body) 0.75 0.04 16.90 0.00 DinoTRUE -5.22 0.53-9.84 0.00

Distribution of Coefficients Joint Distribution under normality ˆβ σ 2 N(β, σ 2 (X T X) 1 )

Distribution of Coefficients Joint Distribution under normality ˆβ σ 2 N(β, σ 2 (X T X) 1 ) Distribution of SSE SSE/σ 2 χ 2 (n p)

Distribution of Coefficients Joint Distribution under normality ˆβ σ 2 N(β, σ 2 (X T X) 1 ) Distribution of SSE SSE/σ 2 χ 2 (n p) Marginal distribution ˆβ j β j SE( ˆβ j ) St(n p) SE( ˆβ j ) = ˆσ [X T X] 1 ] jj ] ˆσ 2 = SSE n p

Confidence Intervals (1 α/2)100% Confidence interval for β j ˆβ j ± t n p,α/2 SE( ˆβ j ) kable(confint(brain2.lm)) 2.5 % 97.5 % (Intercept) 1.760198 2.5630848 log(body) 0.657346 0.8397591 DinoTRUE -6.311226-4.1274760

Converting to Original Units Model after exponentiating brain = e ˆβ 0 +log(body) ˆβ 1 +Dino ˆβ 2 = e ˆβ 0 e log(body) ˆβ 1 e Dino ˆβ 2 = e ˆβ 0 body ˆβ 1 e Dino ˆβ 2

Converting to Original Units Model after exponentiating brain = e ˆβ 0 +log(body) ˆβ 1 +Dino ˆβ 2 = e ˆβ 0 e log(body) ˆβ 1 e Dino ˆβ 2 = e ˆβ 0 body ˆβ 1 e Dino ˆβ 2 10% increase in body weight implies a brain 1.10 = e ˆβ 0 (1.10 body)ˆβ 1 e Dino ˆβ 2 = 1.10 ˆβ 1 e ˆβ 0 body ˆβ 1 e Dino ˆβ 2

Converting to Original Units Model after exponentiating brain = e ˆβ 0 +log(body) ˆβ 1 +Dino ˆβ 2 = e ˆβ 0 e log(body) ˆβ 1 e Dino ˆβ 2 = e ˆβ 0 body ˆβ 1 e Dino ˆβ 2 10% increase in body weight implies a brain 1.10 = e ˆβ 0 (1.10 body)ˆβ 1 e Dino ˆβ 2 = 1.10 ˆβ 1 e ˆβ 0 body ˆβ 1 e Dino ˆβ 2 1.1 ˆβ 1 = 1.074 or a 7.4% increase in brain weight

95% Confidence interval To obtain a 95% confidence interval, (1.10 CI 1) 100 2.5 % 97.5 % body 6.465603 8.332779

Interpretation of Intercept Evalutate model with predictors = 0 log(brain) = ˆβ 0 + log(body) ˆβ 1 + Dino ˆβ 2

Interpretation of Intercept Evalutate model with predictors = 0 log(brain) = ˆβ 0 + log(body) ˆβ 1 + Dino ˆβ 2 For a non-dinosaur, if log(body) = 0 (body weight = 1 kilogram), we expect that brain weight will be 2.16 log(grams)???

Interpretation of Intercept Evalutate model with predictors = 0 log(brain) = ˆβ 0 + log(body) ˆβ 1 + Dino ˆβ 2 For a non-dinosaur, if log(body) = 0 (body weight = 1 kilogram), we expect that brain weight will be 2.16 log(grams)??? Exponentiate: predicted brain weight for non-dinosaur with a 1 kg body weight is e ˆβ 0 = 8.69 grams

Plot of Fitted Values library(ggplot2) beta= coef(brain2.lm) gp = ggplot(animals, aes(y=log(brain), x=log(body))) + geom_point(aes(colour=factor(dino))) + geom_abline(aes(intercept=beta[1], slope=beta[2])) + geom_abline(aes(intercept=(beta[1]+beta[3]), slope=beta[2]))

Plot of Fitted Values 8 6 log(brain) 4 factor(dino) FALSE TRUE 2 0 4 0 4 8 12 log(body)

Confidence Intervals for the f (x) Point Estimate f (x) = x T ˆβ

Confidence Intervals for the f (x) Point Estimate Distribution of MLE given σ f (x) = x T ˆβ f (x) N(f (x), σ 2 x T (X T X) 1 x)

Confidence Intervals for the f (x) Point Estimate Distribution of MLE given σ Distribution of pivotal quantity f (x) = x T ˆβ f (x) N(f (x), σ 2 x T (X T X) 1 x) f (x) f (x) t(n p) ˆσ 2 x T (X T X) 1 x

Confidence Intervals for the f (x) Point Estimate Distribution of MLE given σ Distribution of pivotal quantity Confidence interval f (x) = x T ˆβ f (x) N(f (x), σ 2 x T (X T X) 1 x) f (x) f (x) t(n p) ˆσ 2 x T (X T X) 1 x f (x) ± t α/2 ˆσ 2 x T (X T X) 1 x

Prediction Intervals for Y at x Model Y = x T β + ɛ

Prediction Intervals for Y at x Model Y = x T β + ɛ Y independent of other Y s

Prediction Intervals for Y at x Model Y independent of other Y s Prediction error Y = x T β + ɛ Y f (x) = x T β f (x ) + ɛ

Prediction Intervals for Y at x Model Y independent of other Y s Prediction error Variance Y = x T β + ɛ Y f (x) = x T β f (x ) + ɛ Var(Y f (x)) = Var(x T β f (x )) + Var(ɛ ) = σ 2 x T (X T X) 1 x + σ 2 = σ 2 (1 + x T (X T X) 1 x )

Prediction Intervals for Y at x Model Y independent of other Y s Prediction error Variance Y = x T β + ɛ Y f (x) = x T β f (x ) + ɛ Var(Y f (x)) = Var(x T β f (x )) + Var(ɛ ) Prediction Intervals = σ 2 x T (X T X) 1 x + σ 2 = σ 2 (1 + x T (X T X) 1 x ) f (x) ± t α/2 ˆσ 2 (1 + x T (X T X) 1 x )

Predictions for 259 gram cockatoo 9 6 log(brain) 3 factor(dino) FALSE TRUE 0 4 0 4 8 12 log(body)

Predictions in original units 95% Confidence Interval for f (x) newdata = data.frame(body=.0259, Dino=FALSE) fit = predict(brain2.lm, newdata=newdata, interval="confidence", se=t) 95% Prediction Interval for Brain Weight pred = predict(brain2.lm, newdata=newdata, interval="predict", se=t)

CI/Predictions in original units for body=259 g 95% Confidence Interval for f (x) exp(fit$fit) ## fit lwr upr ## 1 0.5637161 0.2868832 1.107684 95% Prediction Interval for Brain Weight exp(pred$fit) ## fit lwr upr ## 1 0.5637161 0.1131737 2.80786 95% confident that the brain weight will be between 0.11 and 2.81 grams

Summary Linear predictors may be based on functions of other predictors (dummy variables, interactions, non-linear terms)

Summary Linear predictors may be based on functions of other predictors (dummy variables, interactions, non-linear terms) need to change back to original units

Summary Linear predictors may be based on functions of other predictors (dummy variables, interactions, non-linear terms) need to change back to original units log transform useful for non-negative responses (ensures predictions are non-negative)

Summary Linear predictors may be based on functions of other predictors (dummy variables, interactions, non-linear terms) need to change back to original units log transform useful for non-negative responses (ensures predictions are non-negative) Be careful of units of data

Summary Linear predictors may be based on functions of other predictors (dummy variables, interactions, non-linear terms) need to change back to original units log transform useful for non-negative responses (ensures predictions are non-negative) Be careful of units of data plots should show units

Summary Linear predictors may be based on functions of other predictors (dummy variables, interactions, non-linear terms) need to change back to original units log transform useful for non-negative responses (ensures predictions are non-negative) Be careful of units of data plots should show units summary statements should include units

Summary Linear predictors may be based on functions of other predictors (dummy variables, interactions, non-linear terms) need to change back to original units log transform useful for non-negative responses (ensures predictions are non-negative) Be careful of units of data plots should show units summary statements should include units Goodness of fit measure: R 2 and Adjusted R 2 depend on scale R 2 is percent variation in Y that is explained by the model where SST = i (Y i Ȳ ) 2 R 2 = 1 SSE/SST