invesment <- c(50,55,60,65,70,75,80,85,90,95)
output <- c(200,220,230,240,260,270,280,300,310,320)
data <-data.frame(invesment,output)
data
## invesment output
## 1 50 200
## 2 55 220
## 3 60 230
## 4 65 240
## 5 70 260
## 6 75 270
## 7 80 280
## 8 85 300
## 9 90 310
## 10 95 320
plot(invesment, output)

#Regression Model
model <- lm(output ~ invesment, data = data)
summary(model)
##
## Call:
## lm(formula = output ~ invesment, data = data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.2727 -2.8636 0.2727 2.7273 3.8182
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 70.54545 5.02802 14.03 6.46e-07 ***
## invesment 2.65455 0.06803 39.02 2.05e-10 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.09 on 8 degrees of freedom
## Multiple R-squared: 0.9948, Adjusted R-squared: 0.9941
## F-statistic: 1523 on 1 and 8 DF, p-value: 2.045e-10
#Ploting
plot(data$invesment, data$output, xlab = "invesment", ylab = "output", main = "Linear Regresssion")
abline(model, col = "green", lwd = 2)
