x=c(10,20,30,40,50)
y=c(17,18,19,22,24)

plot(x,y)

lm.result=lm(y~x)
lm.result
## 
## Call:
## lm(formula = y ~ x)
## 
## Coefficients:
## (Intercept)            x  
##       14.60         0.18
abline(lm.result)

plot of chunk unnamed-chunk-1

Exercise 13.3

data=read.delim("exer13_3.dat")

plot(data)

str(data)
## 'data.frame':    10 obs. of  2 variables:
##  $ rate : num  14.4 16 11.6 11 10 9.6 9.2 10.4 11.4 12.5
##  $ death: num  29.1 29.7 29.2 26 24 23.1 23 23.1 25.2 26.1
lm.result=lm(death~rate,data=data)
lm.result
## 
## Call:
## lm(formula = death ~ rate, data = data)
## 
## Coefficients:
## (Intercept)         rate  
##       13.49         1.06
abline(lm.result)

plot of chunk unnamed-chunk-2

Intercept=13.487 Rate=1.065

Equation of Least Squares Regression lin: yhat=13.487+1.0649x