# R/Interactive Plots

(Difference between revisions)
Jump to: navigation, search
 Revision as of 17:06, 6 June 2012 (view source)Cole (Talk | contribs) (Started the page with a few examples) Latest revision as of 22:46, 6 June 2012 (view source)Cole (Talk | contribs) m (→Examples: added binomial GLM example) Line 6: Line 6: == Examples == == Examples == I wrote some interactive plots for lab sessions in FISH 458 and QERM 514 and thought I would share them out. I wrote some interactive plots for lab sessions in FISH 458 and QERM 514 and thought I would share them out. + + === Binomial GLM === + A little tool to explore how exactly a binomial GLM works. The level of darkness of the squares is proportional to the probability of observing the data. That is, at each value on the x-axis the probability given by the green line defines a binomial distribution shown by the squares. The red dots are data simulated randomly from the model. {{Rcode|BinomialGLM.R |Binomial GLM}} + [[image: BinomialGLM_test.png |  300 px | center]] === ANCOVA === === ANCOVA ===

## The Manipulate Package

This package is specific to RStudio and is a quick way to provide the ability to interact with R using a simple GUI. You can put sliders, checkboxes, pickers or buttons on parameters which are then fed back into your function. It is surprisingly easy to get up and running, but I have really only found this useful for plots. It can be a great way to familiarize yourself with a new model, or as an instructional tool.

See the help file for manipulate for more information.

## Examples

I wrote some interactive plots for lab sessions in FISH 458 and QERM 514 and thought I would share them out.

### Binomial GLM

A little tool to explore how exactly a binomial GLM works. The level of darkness of the squares is proportional to the probability of observing the data. That is, at each value on the x-axis the probability given by the green line defines a binomial distribution shown by the squares. The red dots are data simulated randomly from the model. Binomial GLM

### ANCOVA

A simple example to help show the relationship between the parameters in a model with 1 continuous and 1 categorical variable. ANCOVA

### Beta Binomial

A classic example for teaching Bayesian statistics. Beta prior on a binomial probability parameter. Beta Binomial

### Predator-Prey System

This is straight from a 458 lab where we were examining the relationship between lions and Wildebeest. The first plot are the population sizes over time, and the second is the phase plane with a smoothly shifting color scheme to show the magnitude of change at the time steps. The big idea here is what happens as density dependence is added (this is the “c” parameter”) to the Wildebeest population. Apologies for the poorly named variables and lack of comments. Predator Prey