R/Interactive Plots

From QERM Wiki
Revision as of 22:46, 6 June 2012 by Cole (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

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. Rlogo.jpg Binomial GLM

BinomialGLM test.png

ANCOVA

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

ANCOVA.png

Beta Binomial

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

BetaBinomial example.png

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. Rlogo.jpg Predator Prey

PredatorPrey.png
Personal tools