quincunx {derivmkts} R Documentation

## Quincunx simulation

### Description

quincunx simulates balls dropping down a pegboard with a 50% chance of bouncing right or left at each level. The balls accumulate in bins. If enough balls are dropped, the distribution approaches normality. This device is called a quincunx. See https://www.mathsisfun.com/data/quincunx.html

### Usage

quincunx(n = 3, numballs = 20, delay = 0.1, probright = 0.5, plottrue = TRUE)


### Arguments

 n Integer The number of peg levels, default is 3 numballs Integer The number of balls dropped, default is 20 delay Numeric Number of seconds between ball drops. Set delay > 0 to see animation with delay seconds between dropped balls. If delay < 0, the simulation will run to completion without delays. If delay == 0, the user must hit for the next ball to drop. The default is 0.1 second and can be set with the delay parameter. probright Numeric The probability the ball bounces to the right; default is 0.5 plottrue Boolean If TRUE, the display will indicate bin levels if the distribution were normal. Default is TRUE

### Examples


## These examples will not display correctly within RStudio unless
## the plot window is large
quincunx(delay=0)
quincunx(n=10, numballs=200, delay=0)
quincunx(n=20, numballs=200, delay=0, probright=0.7)



[Package derivmkts version 0.2.5 Index]