###-----------------------------------------------------------### ### Problem 5.10 ### ###-----------------------------------------------------------### ##--- Enter data x <- c(1935, 1940, 1945, 1950, 1955, 1960, 1965, 1970, 1975,1980) y <- c(32.1, 30.5, 24.4, 23.0, 19.1, 15.6, 12.4, 9.7, 8.9,7.2) ##--- Scatterplot plot(x, y) ##--- Fit the least-squares regression line to data model <- lm(y ~ x) summary(model) ##--- Put the regression line on the scatterplot abline(model) ##--- Calculate residuals residuals(model) ##--- Residual plot plot(x, residuals(model)) abline(h=0) ##--- Some elementary statistics #--Mean mean(x) mean(y) #--Standard deviation sd(x) sd(y) #--Median median(x) median(y) #--Correlation cor(x, y) #--Stem plot stem(x) stem(y) #--Histogram hist(x) hist(y) #--Pie chart pie(x) pie(y)