## reading data ## note the use of read.csv () function rather than read.table() nyc = read.csv('http://www.stat.tamu.edu/~sheather/book/docs/datasets/nyc.csv',header=TRUE) ## reformatting nam = nyc[,2] nyc= nyc[,3:6] # getting rid of columns useless here rownames(nyc) = nam # we need the names but it is not a variable ## EDA pairs(nyc) ## Three different ways to fit the same full model res = lm(formula = Price ~ 1 + Food + Service + Decor,data=nyc) res = lm(formula = Price ~ 1 + Food + Service + Decor,data=nyc) res = lm(formula = Price ~ .,data=nyc) res summary(res) ## Comparing significance of the Service parameter ## in a model that does not contain decor summary(lm(formula = Price ~ 1 + Food + Service + Decor,data=nyc))