Riddler: Simulating a Branching Process
Simulation, Probability distributions (Exponential and Geometric)
Notable topics: Simulation, Probability distributions (Exponential and Geometric)
Recorded on: 2020-04-12
Timestamps by: Alex Cookson
Screencast
Timestamps
Explanation of a Poisson process
Asking "How long do you have to wait for X to happen?", which the Exponential distribution can answer
Using rexp function to generate numbers from the Exponential distribution
Using a vector of rates inside the rexp function (to explore consecutive waiting times)
Using cumsum function to calculate total waiting time until hitting a specific number in the Poisson process
Using which function to determine the first instance > 3 in a vector
Using replicate function to do a quick simulation of the function just written
Discussing methods of making the simulation function faster
Using crossing function to set up "tidy" simulation (gives you all possible combinations of values you provide it)
Noting how the consecutive waiting times seems to follow the Harmonic series
Noticing that we are missing trials with 0 comments and fixing
Using nls function (non-linear least squares) to test how well the data fits with an exponential curve
Visualizing fit between data and the exponential curve calculated with nls in previous step
Using augment function to added fitted values of the nls function
Exploring whether the data actually follows a Geometric distribution
Explanation of the Geometric distribution as it applies to this question
Generalizing the question to ask how long it takes to get to multiple comments (not just 3)
Explanation of why we subtract 1 when fitting an exponential curve
Summary of screencast