TUTFeb5

TUTFeb5 - R code gas consumption data STAT 331 Tutorial...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: # R code: gas consumption data STAT 331 Tutorial, Feb.5, 2010 # multiple regression and hypothesis tests # example data: example 1.2.7 on page11 in Introduction to regression modeling gas=read.table(’E:/gas.txt’,head=T) attach(gas) # read the data set cor(gas) # correlation matrix for ALL variables in data set # gives correlation r, measure of linear relationship between each pair of variables pairs(gas) # look for association between: # 1. response variable and any of predictor variables # 2. any two predictor variables model=lm(MPG ∼ WT+DIS+NC+HP+ACC+ET,data=gas) summary(model) # gives: estimation of regression coefficients, standard errors, t-statistics # here, t k is for testing # H : β k = 0 # H 1 : β k negationslash = 0 # also gives: r 2 , F-statistic # here, F is for testing regression relationship: # H : β 1 = β 2 = ··· = β k = 0 # H 1 : not all β k negationslash = 0 # F α ( p, n − p − 1) = F . 05 (6 , 31) = 2 . 42, when F > 2 . 42, refuse H # t α/ 2 ( n −...
View Full Document

This note was uploaded on 01/20/2011 for the course MATH 332 taught by Professor Jt during the Spring '10 term at Waterloo.

Page1 / 2

TUTFeb5 - R code gas consumption data STAT 331 Tutorial...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online