HW2-Script.html - Linear Regression HW2 Yeyun Chen(yc3070...

This preview shows page 1 - 4 out of 5 pages.

Linear Regression HW2Yeyun Chen (yc3070)2015/10/07# set work directorysetwd("C:/Users/asus/Desktop/Columbia Study Material/4315")# read datatri_city <- read.table("Homework_2_data.txt", col.names = c("Y", "X"), header = FALSE)1(a)Obtain the estimated regression function:fit <- lm(Y ~ X, data = tri_city)coefficients(fit)## (Intercept) X ## -0.5801567 15.0352480So, the estimated regression function is: Y = 15.035248X-0.5801567 1(b)Plot the estimated regression function and the data. How well does the estimated regression function fit the data?
summary(fit)## ## Call:
Max

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture