# A Shiny app for simple linear regression by hand and in R A Shiny app to perform simple linear regression (by hand and in R)

Simple linear regression is a statistical method to summarize and study relationships between two variables. When more than two variables are of interest, it is referred as multiple linear regression. See this article on linear regression for more details.

In this article, we focus only on a Shiny app which allows to perform simple linear regression by hand and in R:

# How to use this app?

1. Open the app via this link
2. Enter your data in the x and y fields. The x field corresponds to the independent variable, while the y field corresponds to the dependent variable
3. If you do not want to display the confidence interval around the regression line, uncheck the checkbox under Plot
4. Change the x and y-axis labels for the regression plot if needed

In the results panel (on the right side or below depending on the size of your screen), you will see:

• a recap of your dataset together with some appropriate descriptive statistics
• the estimates $$\beta_0$$, $$\beta_1$$ and the regression model computed by hand
• the results of the model computed in R
• the regression plot with some key measures
• the interpretations
• and the assumptions to check the validity of the model

All formulas, steps and computations to arrive at the final results are also provided.

Note that although the assumptions are displayed, it is your responsibility to check them to assess the validity of the linear model.

Last but not least, you can download a report of the results (in HTML) by clicking on the Download button, and you can choose whether you want to include the R code or not.

# Code

Here is the entire code (or see the last version on GitHub) in case you would like to enhance it.

Note that the link may not work if the app has hit the monthly usage limit. Try again later if that is the case.

# Conclusion

For further details about what is linear regression and when it is used, please see:

• this post, and
• the numerous resources on the topic available in textbooks and online.