Simple Linear Regression

Calories Data set

wt.cal <- read.csv("D://Users//jayapate//Downloads//calories_consumed.csv")
attach(wt.cal)
plot(Calories, Weight)

cor(Weight,Calories)
## [1] 0.946991
summary(wt.cal)
##      Weight          Calories   
##  Min.   :  62.0   Min.   :1400  
##  1st Qu.: 114.5   1st Qu.:1728  
##  Median : 200.0   Median :2250  
##  Mean   : 357.7   Mean   :2341  
##  3rd Qu.: 537.5   3rd Qu.:2775  
##  Max.   :1100.0   Max.   :3900
sd(Calories)
## [1] 752.1095
var(Weight)
## [1] 111350.7
model2 <- lm(Weight ~ Calories)
summary(model2)
## 
## Call:
## lm(formula = Weight ~ Calories)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -158.67 -107.56   36.70   81.68  165.53 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -625.75236  100.82293  -6.206 4.54e-05 ***
## Calories       0.42016    0.04115  10.211 2.86e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 111.6 on 12 degrees of freedom
## Multiple R-squared:  0.8968, Adjusted R-squared:  0.8882 
## F-statistic: 104.3 on 1 and 12 DF,  p-value: 2.856e-07
#Both Weight and Calories are showing significant