d<- read.csv("regression.csv")
summary(d)
## independent dependent
## Min. : 1.00 Min. :17.61
## 1st Qu.: 5.75 1st Qu.:32.45
## Median :10.50 Median :41.41
## Mean :10.50 Mean :42.33
## 3rd Qu.:15.25 3rd Qu.:52.91
## Max. :20.00 Max. :64.16
boxplot(d$independent)

boxplot(d$dependent)

plot(d)

mod<-lm(dependent~independent, data=d)
summary(mod)
##
## Call:
## lm(formula = dependent ~ independent, data = d)
##
## Residuals:
## Min 1Q Median 3Q Max
## -17.365 -3.618 1.312 3.383 10.815
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 19.7474 3.0211 6.537 3.83e-06 ***
## independent 2.1511 0.2522 8.530 9.72e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 6.503 on 18 degrees of freedom
## Multiple R-squared: 0.8017, Adjusted R-squared: 0.7906
## F-statistic: 72.75 on 1 and 18 DF, p-value: 9.723e-08
g1<-ggplot(d,aes(x=independent,y=dependent)) + geom_point() + geom_smooth(method="lm")
g1

ylab="My text for the ylabel. Give name of variable and units"
xlab="My text for the xlabel. Give name of variable and units"
g1 + ylab(ylab) + xlab(xlab)
