R Code for HW6 - # R Code for HW6 Sta108, Fall 2007, Utts #...

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

View Full Document Right Arrow Icon
1 # R Code for HW6 Sta108, Fall 2007, Utts ### Problem 8.4 Data = read.table ( "~/Documents/School/Sta108utts/CH01PR27.txt" ) names ( Data )= c ( "Mass" , "Age" ) #(a) x1 = Data $ Age - mean ( Data $ Age ) x1sq = x1 ^ 2 Data = cbind ( Data , x1 , x1sq ) #fit a quadratic model (8.2) Quad = lm ( Mass ~ x1 + x1sq , data = Data ) summary ( Quad ) #plot fitted quadratic model plot ( Data $ x1 , Data $ Mass , main = "Polynomial Model" , xlab = "Age(centered)" , ylab = "Mass" , pch = 19 ) #create (x,y) points for quadratic model x = seq (- 20 , 20 , by = .1 ) y = 82.935749 - 1.183958 * x + 0.014840 * x ^ 2 lines ( x , y , col = "blue" ) #(b) #Test for regression relation. #See F-statistic in summary(). summary ( Quad ) qf ( 1 - 0.05 , 2 , 57 ) #F-value F(1-alpha, p-1, n-p) #(e) #Test: Ho: Beta2 = 0, Ha: Beta2 not= 0. #See t-statistic in summary(). qt ( 1 - 0.025 , 57 ) #t-value t(1-alpha/2, n-p) #(g) cor ( Data $ Age , Data $ Age ^ 2 ) cor ( x1 , x1sq ) ### Problem 8.16 Data = read.table ( "~/Documents/School/Sta108utts/GPA.txt"
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/01/2011 for the course ISYE 6414 taught by Professor Staff during the Fall '08 term at Georgia Institute of Technology.

Page1 / 2

R Code for HW6 - # R Code for HW6 Sta108, Fall 2007, Utts #...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online