#############
# Inference approach
# Ex.1 (iris)
#############
str(iris)
iris
?iris
#a)
plot(iris[,-5])

#b)
lm(Petal.Width~Sepal.Length+Sepal.Width+Petal.Length, data =iris)
#or
iris.lm <- lm(Petal.Width~.,data =iris[,-5])
iris.lm
#Petal.Width =  -0.2403 -0.2073 Sepal.Length + 0.2228 Sepal.Width+ 
#                 0.5241 Petal.Length
# P.W = b0 + b1 S.L +  b2 S.W + b3 P.L
summary(iris.lm)
# R^2 = 0.9379

#v. 
#to get t_0.025;(146) The value of a t-Student distribution
qt(0.975,146)

# 95% Confidence Interval of Beta_1
-0.20727 -  1.976346 * 0.04751 #lower end
-0.20727 +  1.976346 * 0.04751 #upper end
# ] -0.3011662 , -0.1133738 [
confint(iris.lm)
