Here is some code, a brute-force approach, to get a ballpark for the probability.
In this I assume that the particular 30 day window does not matter. If there were 3 at the end of one month and 2 at the beginning of the next, I still count it as 5 in a row.
set.seed(1)
#number of runs
N <- 5e5
#max number of events per month (simulation tops out around 4)
n_max <- 10
#other parameters
n_years <- 10
days_per_year <- 365.24
#would be number of rows if year change was reset
n <- floor(n_years*days_per_year)
#sample is wrapped in this to handle workspace and memory
#find run lengths
my_rle <- rle(rbinom(n = n*N,prob = 0.01,size = 1))
#find run-lengths that refer to "TRUE" values sequences
idx <- which(my_rle$values ==1)
#subset out non-zero runs
cus_y <- my_rle$lengths[idx]
#pre-declare for loop
store<- numeric(length = n_max)
#put zeros into a single bin
store[1] <- sum(my_rle$lengths[-idx])/n/N
#find bin frequenceis
for (j in 1:(n_max-1)){
store[j+1] <- length(which(cus_y==j,arr.ind=T))/n/N
}
#stage for plot and model
x <- 0:(n_max-1)
y <- log10(store)
#subset to non-nan values
y1 <- y[1:5]
x1 <- seq(from=0,to=4,by=1)
#fit model
est <- lm(y1~x1)
summary( est)
#extrapolate
x2 <- 5
y2 <- est$coefficients[1]+est$coefficients[2]*x2
y2
#main plot
plot(x,y,ylab="Log10 frequency", xlab="run length",ylim = c(-10,0))
grid()
abline(est)
points(x2,y2,pch=19,col="Red",cex=1.2)
Here is the plot that I get
The fit gave me this summary:
> summary( est)
Call:
lm(formula = y1 ~ x1)
Residuals:
1 2 3 4 5
0.0072500 0.0007404 -0.0025619 -0.0260976 0.0206690
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.01161 0.01528 -0.76 0.503
x1 -1.99795 0.00624 -320.21 6.72e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.01973 on 3 degrees of freedom
Multiple R-squared: 1, Adjusted R-squared: 1
F-statistic: 1.025e+05 on 1 and 3 DF, p-value: 6.717e-08
Using the coefficients gives -10.00137 as the expected log10 of frequency for runs of 5 in a row. This is ~1e-10. The estimated probability for a 5-element sequence at any time is 1e-10, or (0.01^5).