quincunx {derivmkts} | R Documentation |
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
quincunx(n = 3, numballs = 20, delay = 0.1, probright = 0.5, plottrue = TRUE)
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 |
probright |
Numeric The probability the ball bounces to the right; default is 0.5 |
plottrue |
Boolean If |
## 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)