Description Usage Arguments Details Value Functions Examples
This function simulates the geyser scenario described in FiveThirtyEight's Riddler. The simulation is built from several support functions. They are all documented together.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | geyser(...)
## S3 method for class 'geyser'
simulate(object, n, timeframe = NULL, seed = NULL)
eruptions(rate, timeframe)
geysers(rates, timeframe)
first_eruption(geysers, arrival)
count_v(level, vector)
count_seq(vector, levels)
## S3 method for class 'simulate.geyser'
summary(object, nwindows = 11)
## S3 method for class 'summary.geyser'
print(object)
## S3 method for class 'geyser'
autoplot(object)
|
n |
The number of iterations in a simulation |
timeframe |
The time window for the eruptions; default is maximum rate |
rates |
A named |
The problem states that you arrive at a national park, knowing that three geysers erupt at fixed intervals. You do not know when these intervals begin. What are the probabilites that each geyser erupts first? The blog post for this function solved the problem analytically. This code simulates the scenario to arrive at a solution.
A geyser
objection containing the following:
a data frame tracking which geyser erupts first each simulation
a data frame that counts relative rates: count / n simulations
a data frame of the time until each geyser's first eruption
the number of simulations
the list of rates passed as an argument
eruptions
: Simulate the eruption of a single geyser
geysers
: Simulate multiple geysers, given rates
first_eruption
: Find the time to each geyser's first eruption
count_v
: Count the number of times a level appears in a vector
count_seq
: Given a vector and a set of levels, count how often
each level appears
1 2 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.