author: Paul Clark date: 06-04-2017 autosize: true css: ie11fix.css
See app at https://clarpaul.shinyapps.io/add_point/
For all code, see repo https://github.com/clarpaul/DevDataProducts_Project/
App code in subfolder "Add_Point
"
Primary Goals
- Visualize regression statistics
- Correlation coefficients
- P-values
- Understand how adding data affects p-values
- See how differently positioned points impact the regression
- Which points most affect the best-fit line
- I.e., which points are high vs. low leverage/influence
- Have fun!
- The app displays a 2D scatterplot and regression line
- The user clicks plot locations to add observations in red
- With each added observation, the app updates and displays...
- the observation's coordinates
- the regression line for the scatterplot
- the equation for the line
- the correlation coef and p-value of the slope/regression
- Input widgets include...
- check-box to show or hide the original trend line
- button to clear added points and start over
class: small-code
plot(mtcars$mpg, mtcars$hp,
main = paste0("Horsepower",
" vs. Miles-per-gallon"),
xlab = "MPG", ylab = "HP",
bty = "n", pch = 16,
xlim = c(10, 35),
ylim = c(50, 350))
mtext("R `mtcars` dataset")
model1 <- lm(hp ~ mpg,
data = mtcars)
abline(model1, col = "red",
lwd = 2)