# uzupelnic fig_captions, zeby dalo sie je zrobic
library(kendallRandomWalks)
kendall_rws <- simulate_kendall_rw(10, 100, runif, 0.25)
kendall_rws
#> Simulations of Kendall random walk
#> Number of simulations: 10
#> Length of a single simulation: 100
#> Step distribution: runif
#> Alpha parameter: 0.25
plot(kendall_rws)
plot(simulate_kendall_rw(10, 100, rnorm, 0.76), level = 300)
Symmetric
kendall_rws_sym <- simulate_kendall_rw(10, 100, rnorm, 0.76, T)
kendall_rws_sym
#> Simulations of Kendall random walk
#> Number of simulations: 10
#> Length of a single simulation: 100
#> Step distribution: rnorm
#> Alpha parameter: 0.76
plot(kendall_rws_sym)
kendall_rws2 <- simulate_kendall_rw(1000, 100, runif, 0.25)
ladder_moments <- ladder_moment(kendall_rws2, 1000)
ladder_moments
#> Mean of the distribution: 15.726
#> Standard deviation of the distribution: 9.839397
#> Number of observations: 1000
#> Times the level was not crossed: 0
#> Quantiles of the distribution:
#> 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
#> 3 6 8 10 11 13 15 19 23 29 64
plot(ladder_moments)
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
ladder_heights <- ladder_height(kendall_rws2, 2000)
ladder_heights
#> Mean of the distribution: 8438489
#> Standard deviation of the distribution: 181627127
#> Number of observations: 1000
#> Times the level was not crossed: 0
#> Quantiles of the distribution:
#> 0% 10% 20% 30% 40%
#> 2.001583e+03 2.374325e+03 3.013069e+03 3.928392e+03 5.260592e+03
#> 50% 60% 70% 80% 90%
#> 7.180237e+03 1.095814e+04 1.862697e+04 4.335170e+04 1.705180e+05
#> 100%
#> 5.583728e+09
plot(ladder_heights)
#> `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Exact first ladder moments distribution with \(G(a)\) computed numerically.
y <- seq(10, 10000, 50)
ladders <- sapply(y,
function(x)
ladder_moment_pmf(10, x, 0.5, pnorm, dnorm))
plot(y, ladders)
y <- seq(2000, 2200, 1)
plot(y, g_function(y, 0.1, dnorm))
plot(seq(0, 400, by = 1), g_function(seq(0, 400, by = 1), 0.5, dunif))