A shiny app to demonstrate the different influence of points in linear regression

Frank Cheng
Sun Feb 22 09:56:46 2015

Motivation (1)

In Regression Models, we learnt that the influence of the points to LR model are different. Demonstrated in the example below: plot of chunk unnamed-chunk-1

Motivation (2)

  • The example in the last slide actually not easy for me to understand.
  • Shiny is a good tool to interatively stduy the question

App design

  • Do LR to all the points shown in slide 2 and plot in the figure (default)
  • Let user choose which point to be removed (in the 4 red points)
  • After chosen the point, do LR again and plot it in the same figure
  • Show the difference of slope coefficent

Layout and Run the app

Layout

  • sidebar: Radio button to select which point to study (1~4)
  • main panel: 1) Introduction 2) Plot: the scatter plot, 1-4 label point, LR line to all the points(black line), the point you've chosen (red point), LR line to the point after removing the chosen point (red line) 3) slope difference

You can download my app and run in the folder containing ui.R and server.R via the command as shown below:

runApp()

Or try it: https://biomystery.shinyapps.io/LRInfluenceApp/