Used Car Models

summary(cars)
##      speed           dist    
##  Min.   : 4.0   Min.   :  2  
##  1st Qu.:12.0   1st Qu.: 26  
##  Median :15.0   Median : 36  
##  Mean   :15.4   Mean   : 43  
##  3rd Qu.:19.0   3rd Qu.: 56  
##  Max.   :25.0   Max.   :120

You can also embed plots, for example:

cars = fetchGoogle("https://docs.google.com/spreadsheet/pub?key=0Akkdc3QLDbyAdGxNRDAzcG5aRGJBSVFHa3ljaHVObnc&output=csv")
## Loading required package: RCurl
## Loading required package: bitops
plot(Price ~ Miles, data = cars)

plot of chunk unnamed-chunk-3

mod = lm(Price ~ Miles, data = cars)
xyplot(Price + fitted(mod) ~ Miles, data = cars)

plot of chunk unnamed-chunk-4

var(resid(mod))
## [1] 5301406
summary(mod)
## 
## Call:
## lm(formula = Price ~ Miles, data = cars)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
##  -4435  -1695    303   1628   3961 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  2.32e+04   1.75e+03   13.21  6.5e-09 ***
## Miles       -9.35e-02   1.37e-02   -6.84  1.2e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## Residual standard error: 2390 on 13 degrees of freedom
## Multiple R-squared: 0.783,   Adjusted R-squared: 0.766 
## F-statistic: 46.8 on 1 and 13 DF,  p-value: 1.19e-05