Interactively Build a Scatterplot and Explore Correlation and Regression
ShinyPutPoints.RdLaunches a Shiny app with a blank plot that you build up by clicking to add points (points can also be deleted or moved). Options let you display the correlation, the least squares regression line, a manually specified line, the residual sum of squares, and the rectangles used to illustrate the covariance between x and y.
Details
This function requires the shiny package to be installed. Use the “Action” radio buttons to choose whether clicking on the plot adds, deletes, or moves a point. The checkboxes let you show the correlation, the least-squares line, the rectangles corresponding to \((x_i - \bar x)(y_i - \bar y)\) (used to build intuition about correlation), the residual sum of squares for the least-squares line, and a manually specified line (with its own residual sum of squares) so that you can try to find a better- or worse-fitting line by hand.
Value
Launches the app in non-blocking mode (via
startApp) and returns a ShinyAppHandle
immediately, so the R console remains available while the app runs
in the background. Use handle$stop() to stop the app.
Author
Greg Snow 538280@gmail.com
Examples
if(interactive()) {
h <- ShinyPutPoints()
# h$stop() # run this when finished with the app
}