# Demonstrate Correlation and Regression by placing and moving data points

### Description

Place data points on a graph to demonstrate concepts related to correlation and regression.

### Usage

1 | ```
put.points.demo(x = NULL, y = NULL, lsline = TRUE)
``` |

### Arguments

`x` |
x-coordinates for initial points. |

`y` |
y-coordinates for initial points. |

`lsline` |
Logical, should the ls regresion line be included. |

### Details

The plot area is divided into 2 sections, the left section shows a scatterplot of your points, the right panel controls what happens when you click in the left panel.

The top of the right panel has an "end" button that you click on to end the demonstration.

The middle right panel toggles the least squares line and information.

The bottom right panel has radio buttons that determine what clicking in the left panel will do, the options are to add a point, delete a point, or move a point.

To move a point click on the point you want to move, it will become solid, then click in the place you want it to move to.

When deleting or moving points, the closest point to where you click will be deleted or moved, even if you click in an empty area.

Whenever you add, delete, or move a point the correlation, r\^2, and regression line will be updated. You can start with a set of points then demonstrate what happens to the correlation and regression line when outliers are added or important points are moved or deleted.

### Value

This function does not return anything.

### Author(s)

Greg Snow 538280@gmail.com

### See Also

`plot`

, `cor`

### Examples

1 2 3 4 5 6 7 | ```
if(interactive()){
put.points.demo()
x <- rnorm(25, 5, 1)
y <- x + rnorm(25)
put.points.demo(x,y)
}
``` |