View source: R/AmbitSimulation.R
| sim_weighted_trawl_gen | R Documentation |
This function simulates a weighted trawl process for a generic trawl function and various choices the marginal distribution. The specific trawl function to be used can be supplied directly by the user.
sim_weighted_trawl_gen( n, Delta, trawlfct_gen, distr, distr_par, kernelfct = NULL )
n |
number of grid points to be simulated (excluding the starting value) |
Delta |
grid-width |
trawlfct_gen |
the trawl function a used in the simulation |
distr |
marginal distribution. Choose from "Gamma" (Gamma), "Gauss" (Gaussian), "Cauchy" (Cauchy), "NIG" (Normal Inverse Gaussian), Poi" (Poisson), "NegBin" (Negative Binomial) |
distr_par |
parameters of the marginal distribution: (Gamma: shape, scale; Gauss: mu, sigma (i.e. the second parameter is the standard deviation, not the variance); Cauchy: l, s; NIG: alpha, beta, delta, mu; Poi: v, NegBin: m, theta) |
kernelfct |
the kernel function p used in the ambit process |
This functions simulates a sample path from a weighted trawl process given by
Y_t =\int_{(-∞,t]\times (-∞, ∞)} p(t-s)I_{(0,a(t-s))}(x)L(dx,ds),
for t ≥ 0, and returns Y_0, Y_{Δ}, …, Y_{nΔ}. The user needs to ensure that trawlfct_gen is a monotonic function.
path Simulated path
slice_sizes slice sizes used
S_matrix Matrix of all slices
kernelweights kernel weights used
#Simulation of a Gaussian trawl process with exponential trawl function
n<-2000
Delta<-0.1
trawlfct_par <-0.5
distr<-"Gauss"
distr_par<-c(0,1) #mean 0, std 1
set.seed(233)
a <- function(x){exp(-trawlfct_par*x)}
path <- sim_weighted_trawl_gen(n, Delta, a,
distr, distr_par)$path
#Plot the path
library(ggplot2)
df <- data.frame(time = seq(0,n,1), value=path)
p <- ggplot(df, aes(x=time, y=path))+
geom_line()+
xlab("l")+
ylab("Trawl process")
p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.