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.
In this article, we focus only on a Shiny app which allows to perform simple linear regression by hand and in R:
For further details about what is linear regression and when it is used, please see the numerous resources on the topic available in textbooks and online.
How to use this app?
Follow these steps:
- Open the app via this link
- 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
- If you do not want to display the confidence interval around the regression line, uncheck the checkbox under Plot
- 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
- and the interpretations
All formulas, steps and computations to arrive at the final results are also provided. Note that it is your responsibility to check the validity of your linear model. This app only serves you to compute the results of the linear model given the data but it does not check whether the assumptions are met. Last but not least, you can download a report of the results by clicking on the Download button. You can choose the format of the report (i.e., HTML, PDF or Word) and whether you want to include the R code or not.
I hope you will find this app useful to do simple linear regression by hand and in R. See all other articles related to Shiny here. As always, if you find a mistake/bug or if you have any questions do not hesitate to let me know in the comment section below, raise an issue on GitHub or contact me. Get updates every time a new article is published by subscribing to this blog.