Title: | Estimation and Simulation of Trawl Processes |
---|---|
Description: | Contains R functions for simulating and estimating integer-valued trawl processes as described in the article Veraart (2019),"Modeling, simulation and inference for multivariate time series of counts using trawl processes", Journal of Multivariate Analysis, 169, pages 110-129, <doi:10.1016/j.jmva.2018.08.012> and for simulating random vectors from the bivariate negative binomial and the bi- and trivariate logarithmic series distributions. |
Authors: | Almut E. D. Veraart |
Maintainer: | Almut E. D. Veraart <[email protected]> |
License: | GPL-3 |
Version: | 0.2.2 |
Built: | 2025-02-14 04:27:42 UTC |
Source: | https://github.com/cran/trawl |
This function computes the autocorrelation function associated with the double exponential trawl function.
acf_DExp(x, w, lambda1, lambda2)
acf_DExp(x, w, lambda1, lambda2)
x |
The argument (lag) at which the autocorrelation function associated with the double exponential trawl function will be evaluated |
w |
parameter in the double exponential trawl |
lambda1 |
parameter in the double exponential trawl |
lambda2 |
parameter in the double exponential trawl |
The trawl function is parametrised by parameters
and
as follows:
Its autocorrelation function is given by:
where
The autocorrelation function of the double exponential trawl function evaluated at x
acf_DExp(1,0.3,0.1,2)
acf_DExp(1,0.3,0.1,2)
This function computes the autocorrelation function associated with the exponential trawl function.
acf_Exp(x, lambda)
acf_Exp(x, lambda)
x |
The argument (lag) at which the autocorrelation function associated with the exponential trawl function will be evaluated |
lambda |
parameter in the exponential trawl |
The trawl function is parametrised by the parameter
as follows:
Its autocorrelation function is given by:
The autocorrelation function of the exponential trawl function evaluated at x
acf_Exp(1,0.1)
acf_Exp(1,0.1)
This function computes the autocorrelation function associated with the long memory trawl function.
acf_LM(x, alpha, H)
acf_LM(x, alpha, H)
x |
The argument (lag) at which the autocorrelation function associated with the long memory trawl function will be evaluated |
alpha |
parameter in the long memory trawl |
H |
parameter in the long memory trawl |
The trawl function is parametrised by the two parameters
and
as follows:
Its autocorrelation function is given by
The autocorrelation function of the long memory trawl function evaluated at x
acf_LM(1,0.3,1.5)
acf_LM(1,0.3,1.5)
This function computes the autocorrelation function associated with the supIG trawl function.
acf_supIG(x, delta, gamma)
acf_supIG(x, delta, gamma)
x |
The argument (lag) at which the autocorrelation function associated with the supIG trawl function will be evaluated |
delta |
parameter in the supIG trawl |
gamma |
parameter in the supIG trawl |
The trawl function is parametrised by the two parameters and
as follows:
It is assumed that and
are
not simultaneously equal to zero. Its autocorrelation function is given by:
The autocorrelation function of the supIG trawl function evaluated at x
acf_supIG(1,0.3,0.1)
acf_supIG(1,0.3,0.1)
Simulates from the bivariate logarithmic series distribution
Bivariate_LSDsim(N, p1, p2)
Bivariate_LSDsim(N, p1, p2)
N |
number of data points to be simulated |
p1 |
parameter |
p2 |
parameter |
The probability mass function of a random vector
following the bivariate logarithmic series distribution with parameters
with
is given by
for such
that
. The simulation proceeds in two steps: First,
is simulated from the modified logarithmic distribution with parameters
and
. Then
we simulate
conditional on
. We note that
follows the logarithmic series distribution with
parameter
when
, and the negative binomial
distribution with parameters
when
.
An matrix with
simulated values from the
bivariate logarithmic series distribution
Simulates from the bivariate negative binomial distribution
Bivariate_NBsim(N, kappa, p1, p2)
Bivariate_NBsim(N, kappa, p1, p2)
N |
number of data points to be simulated |
kappa |
parameter |
p1 |
parameter |
p2 |
parameter |
A random vector is said to follow the
bivariate negative binomial distribution with parameters
if its probability mass function is given by
where,
for ,
,
such that
and
.
An matrix with
simulated values from the bivariate negative
binomial distribution
Computes the correlation of the components of a bivariate vector following the bivariate logarithmic series distribution
BivLSD_Cor(p1, p2)
BivLSD_Cor(p1, p2)
p1 |
parameter |
p2 |
parameter |
Correlation of the components of a bivariate vector following the bivariate logarithmic series distribution
Computes the covariance of the components of a bivariate vector following the bivariate logarithmic series distribution
BivLSD_Cov(p1, p2)
BivLSD_Cov(p1, p2)
p1 |
parameter |
p2 |
parameter |
Covariance of the components of a bivariate vector following the bivariate logarithmic series distribution
Computes the correlation of the components of a bivariate vector following the bivariate modified logarithmic series distribution
BivModLSD_Cor(delta, p1, p2)
BivModLSD_Cor(delta, p1, p2)
delta |
parameter |
p1 |
parameter |
p2 |
parameter |
Covariance of the components of a bivariate vector following the bivariate modified logarithmic series distribution
Computes the covariance of the components of a bivariate vector following the bivariate modified logarithmic series distribution
BivModLSD_Cov(delta, p1, p2)
BivModLSD_Cov(delta, p1, p2)
delta |
parameter |
p1 |
parameter |
p2 |
parameter |
Covariance of the components of a bivariate vector following the bivariate modified logarithmic series distribution
Fits the trawl function consisting of the weighted sum of two exponential functions
fit_DExptrawl(x, Delta = 1, GMMlag = 5, plotacf = FALSE, lags = 100)
fit_DExptrawl(x, Delta = 1, GMMlag = 5, plotacf = FALSE, lags = 100)
x |
vector of equidistant time series data |
Delta |
interval length of the time grid used in the time series, the default is 1 |
GMMlag |
lag length used in the GMM estimation, the default is 5 |
plotacf |
binary variable specifying whether or not the empirical and fitted autocorrelation function should be plotted |
lags |
number of lags to be used in the plot of the autocorrelation function |
The trawl function is parametrised by the three parameters and
as follows:
The Lebesgue measure
of the corresponding trawl set is given by
.
w: the weight parameter (restricted to be in [0,0.5] for identifiability reasons)
lambda1: the first memory parameter (denoted by above)
lambda2: the second memory parameter (denoted by
above)
LM: The Lebesgue measure of the trawl set associated with the double exponential trawl
Fits an exponential trawl function to equidistant time series data
fit_Exptrawl(x, Delta = 1, plotacf = FALSE, lags = 100)
fit_Exptrawl(x, Delta = 1, plotacf = FALSE, lags = 100)
x |
vector of equidistant time series data |
Delta |
interval length of the time grid used in the time series, the default is 1 |
plotacf |
binary variable specifying whether or not the empirical and fitted autocorrelation function should be plotted |
lags |
number of lags to be used in the plot of the autocorrelation function |
The trawl function is parametrised by the parameter
as follows:
The
Lebesgue measure of the corresponding trawl set is given by .
lambda: the memory parameter in the exponential trawl
LM: the Lebesgue measure of the trawl set associated with the
exponential trawl, i.e. .
Fits a long memory trawl function to equidistant univariate time series data
fit_LMtrawl(x, Delta = 1, GMMlag = 5, plotacf = FALSE, lags = 100)
fit_LMtrawl(x, Delta = 1, GMMlag = 5, plotacf = FALSE, lags = 100)
x |
vector of equidistant time series data |
Delta |
interval length of the time grid used in the time series, the default is 1 |
GMMlag |
lag length used in the GMM estimation, the default is 5 |
plotacf |
binary variable specifying whether or not the empirical and fitted autocorrelation function should be plotted |
lags |
number of lags to be used in the plot of the autocorrelation function |
The trawl function is parametrised by the two parameters
and
as follows:
The Lebesgue measure of the corresponding trawl set is given by
.
alpha: parameter in the long memory trawl
H: parameter in the long memory trawl
LM: The Lebesgue measure of the trawl set associated with the long memory trawl
Fist a negative binomial distribution as marginal law
fit_marginalNB(x, LM, plotdiag = FALSE)
fit_marginalNB(x, LM, plotdiag = FALSE)
x |
vector of equidistant time series data |
LM |
Lebesgue measure of the estimated trawl |
plotdiag |
binary variable specifying whether or not diagnostic plots should be provided |
The moment estimator for the parameters of the negative binomial distribution are given by
and
m: parameter in the negative binomial marginal distribution
theta: parameter in the negative binomial marginal distribution
a: Here . This is given for an alternative
parametrisation of the negative binomial marginal distribution
Fits a Poisson distribution as marginal law
fit_marginalPoisson(x, LM, plotdiag = FALSE)
fit_marginalPoisson(x, LM, plotdiag = FALSE)
x |
vector of equidistant time series data |
LM |
Lebesgue measure of the estimated trawl |
plotdiag |
binary variable specifying whether or not diagnostic plots should be provided |
The moment estimator for the Poisson rate parameter is given by
v: the rate parameter in the Poisson marginal distribution
Fits a supIG trawl function to equidistant univariate time series data
fit_supIGtrawl(x, Delta = 1, GMMlag = 5, plotacf = FALSE, lags = 100)
fit_supIGtrawl(x, Delta = 1, GMMlag = 5, plotacf = FALSE, lags = 100)
x |
vector of equidistant time series data |
Delta |
interval length of the time grid used in the time series, the default is 1 |
GMMlag |
lag length used in the GMM estimation, the default is 5 |
plotacf |
binary variable specifying whether or not the empirical and fitted autocorrelation function should be plotted |
lags |
number of lags to be used in the plot of the autocorrelation function |
The trawl function is parametrised by the two parameters and
as follows:
It is assumed that and
are
not simultaneously equal to zero. The Lebesgue measure of the corresponding
trawl set is given by
.
delta: parameter in the supIG trawl
gamma: parameter in the supIG trawl
LM: The Lebesgue measure of the trawl set associated with the supIG trawl
Finds the intersection of two trawl sets
fit_trawl_intersection( fct1 = base::c("Exp", "DExp", "supIG", "LM"), fct2 = base::c("Exp", "DExp", "supIG", "LM"), lambda11 = 0, lambda12 = 0, w1 = 0, delta1 = 0, gamma1 = 0, alpha1 = 0, H1 = 0, lambda21 = 0, lambda22 = 0, w2 = 0, delta2 = 0, gamma2 = 0, alpha2 = 0, H2 = 0, LM1, LM2, plotdiag = FALSE )
fit_trawl_intersection( fct1 = base::c("Exp", "DExp", "supIG", "LM"), fct2 = base::c("Exp", "DExp", "supIG", "LM"), lambda11 = 0, lambda12 = 0, w1 = 0, delta1 = 0, gamma1 = 0, alpha1 = 0, H1 = 0, lambda21 = 0, lambda22 = 0, w2 = 0, delta2 = 0, gamma2 = 0, alpha2 = 0, H2 = 0, LM1, LM2, plotdiag = FALSE )
fct1 |
specifies the type of the first trawl function |
fct2 |
specifies the type of the second trawl function |
lambda11 , lambda12 , w1
|
parameters of the (double) exponential trawl functions of the first process |
delta1 , gamma1
|
parameters of the supIG trawl functions of the first process |
alpha1 , H1
|
parameters of the long memory trawl function of the first process |
lambda21 , lambda22 , w2
|
parameters of the (double) exponential trawl functions of the second process |
delta2 , gamma2
|
parameters of the supIG trawl functions of the second process |
alpha2 , H2
|
parameters of the long memory trawl function of the second process |
LM1 |
Lebesgue measure of the first trawl |
LM2 |
Lebesgue measure of the second trawl |
plotdiag |
binary variable specifying whether or not diagnostic plots should be provided |
Computes based on two trawl
functions
and
.
The Lebesgue measure of the intersection of the two trawl sets
Finds the intersection of two exponential trawl sets
fit_trawl_intersection_Exp(lambda1, lambda2, LM1, LM2, plotdiag = FALSE)
fit_trawl_intersection_Exp(lambda1, lambda2, LM1, LM2, plotdiag = FALSE)
lambda1 , lambda2
|
parameters of the two exponential trawls |
LM1 |
Lebesgue measure of the first trawl |
LM2 |
Lebesgue measure of the second trawl |
plotdiag |
binary variable specifying whether or not diagnostic plots should be provided |
Computes based on two trawl
functions
and
.
The Lebesgue measure of the intersection of the two trawl sets
Finds the intersection of two long memory (LM) trawl sets
fit_trawl_intersection_LM(alpha1, H1, alpha2, H2, LM1, LM2, plotdiag = FALSE)
fit_trawl_intersection_LM(alpha1, H1, alpha2, H2, LM1, LM2, plotdiag = FALSE)
alpha1 , H1 , alpha2 , H2
|
parameters of the two long memory trawls |
LM1 |
Lebesgue measure of the first trawl |
LM2 |
Lebesgue measure of the second trawl |
plotdiag |
binary variable specifying whether or not diagnostic plots should be provided |
Computes based on two trawl
functions
and
.
the Lebesgue measure of the intersection of the two trawl sets
Computes the mean of the logarithmic series distribution
LSD_Mean(p)
LSD_Mean(p)
p |
parameter of the logarithmic series distribution |
A random variable has logarithmic series distribution with
parameter
if
Mean of the logarithmic series distribution
Computes the variance of the logarithmic series distribution
LSD_Var(p)
LSD_Var(p)
p |
parameter of the logarithmic series distribution |
A random variable has logarithmic series distribution with
parameter
if
Variance of the logarithmic series distribution
Computes the mean of the modified logarithmic series distribution
ModLSD_Mean(delta, p)
ModLSD_Mean(delta, p)
delta |
parameter |
p |
parameter of the modified logarithmic series distribution |
A random variable has modified logarithmic series
distribution with parameters
and
if
and
Mean of the modified logarithmic series distribution
Computes the variance of the modified logarithmic series distribution
ModLSD_Var(delta, p)
ModLSD_Var(delta, p)
delta |
parameter |
p |
parameter of the modified logarithmic series distribution |
A random variable has modified logarithmic series
distribution with parameters
and
if
and
Mean of the modified logarithmic series distribution
Plots the bivariate histogram of two time series together with the univariate histograms
plot_2and1hist(x, y)
plot_2and1hist(x, y)
x |
vector of equidistant time series data |
y |
vector of equidistant time series data (of the same length as x) |
This function plots the bivariate histogram of two time series together with the univariate histograms
no return value
Plots the bivariate histogram of two time series together with the univariate histograms using ggplot2
plot_2and1hist_gg(x, y, bivbins = 50, xbins = 30, ybins = 30)
plot_2and1hist_gg(x, y, bivbins = 50, xbins = 30, ybins = 30)
x |
vector of equidistant time series data |
y |
vector of equidistant time series data (of the same length as x) |
bivbins |
number of bins in the bivariate histogram |
xbins |
number of bins in the histogram of x |
ybins |
number of bins in the histogram of y |
This function plots the bivariate histogram of two time series together with the univariate histograms
no return value
Simulates a bivariate trawl process
sim_BivariateTrawl( t, Delta = 1, burnin = 10, marginal = base::c("Poi", "NegBin"), dependencetype = base::c("fullydep", "dep"), trawl1 = base::c("Exp", "DExp", "supIG", "LM"), trawl2 = base::c("Exp", "DExp", "supIG", "LM"), v1 = 0, v2 = 0, v12 = 0, kappa1 = 0, kappa2 = 0, kappa12 = 0, a1 = 0, a2 = 0, lambda11 = 0, lambda12 = 0, w1 = 0, delta1 = 0, gamma1 = 0, alpha1 = 0, H1 = 0, lambda21 = 0, lambda22 = 0, w2 = 0, delta2 = 0, gamma2 = 0, alpha2 = 0, H2 = 0 )
sim_BivariateTrawl( t, Delta = 1, burnin = 10, marginal = base::c("Poi", "NegBin"), dependencetype = base::c("fullydep", "dep"), trawl1 = base::c("Exp", "DExp", "supIG", "LM"), trawl2 = base::c("Exp", "DExp", "supIG", "LM"), v1 = 0, v2 = 0, v12 = 0, kappa1 = 0, kappa2 = 0, kappa12 = 0, a1 = 0, a2 = 0, lambda11 = 0, lambda12 = 0, w1 = 0, delta1 = 0, gamma1 = 0, alpha1 = 0, H1 = 0, lambda21 = 0, lambda22 = 0, w2 = 0, delta2 = 0, gamma2 = 0, alpha2 = 0, H2 = 0 )
t |
parameter which specifying the length of the time interval
|
Delta |
parameter |
burnin |
parameter specifying the length of the burn-in period at the beginning of the simulation |
marginal |
parameter specifying the marginal distribution of the trawl |
dependencetype |
Parameter specifying the type of dependence |
trawl1 |
parameter specifying the type of the first trawl function |
trawl2 |
parameter specifying the type of the second trawl function |
v1 , v2 , v12
|
parameters of the Poisson distribution |
kappa1 , kappa2 , kappa12 , a1 , a2
|
parameters of the (possibly bivariate) negative binomial distribution |
lambda11 , lambda12 , w1
|
parameters of the exponential (or double-exponential) trawl function of the first process |
delta1 , gamma1
|
parameters of the supIG trawl function of the first process |
alpha1 , H1
|
parameter of the long memory trawl of the first process |
lambda21 , lambda22 , w2
|
parameters of the exponential (or double-exponential) trawl function of the second process |
delta2 , gamma2
|
parameters of the supIG trawl function of the second process |
alpha2 , H2
|
parameter of the long memory trawl of the second process |
This function simulates a bivariate trawl process with either Poisson or negative binomial marginal law. For the trawl function there are currently four choices: exponential, double-exponential, supIG or long memory. More details on the precise simulation algorithm is available in the vignette.
Simulates a univariate trawl process
sim_UnivariateTrawl( t, Delta = 1, burnin = 10, marginal = base::c("Poi", "NegBin"), trawl = base::c("Exp", "DExp", "supIG", "LM"), v = 0, m = 0, theta = 0, lambda1 = 0, lambda2 = 0, w = 0, delta = 0, gamma = 0, alpha = 0, H = 0 )
sim_UnivariateTrawl( t, Delta = 1, burnin = 10, marginal = base::c("Poi", "NegBin"), trawl = base::c("Exp", "DExp", "supIG", "LM"), v = 0, m = 0, theta = 0, lambda1 = 0, lambda2 = 0, w = 0, delta = 0, gamma = 0, alpha = 0, H = 0 )
t |
parameter which specifying the length of the time interval
|
Delta |
parameter |
burnin |
parameter specifying the length of the burn-in period at the beginning of the simulation |
marginal |
parameter specifying the marginal distribution of the trawl |
trawl |
parameter specifying the type of trawl function |
v |
parameter of the Poisson distribution |
m |
parameter of the negative binomial distribution |
theta |
parameter |
lambda1 |
parameter |
lambda2 |
parameter |
w |
parameter of the double-exponential trawl function |
delta |
parameter |
gamma |
parameter |
alpha |
parameter |
H |
parameter of the long memory trawl function |
This function simulates a univariate trawl process with either Poisson or negative binomial marginal law. For the trawl function there are currently four choices: exponential, double-exponential, supIG or long memory. More details on the precise simulation algorithm is available in the vignette.
Evaluates the double exponential trawl function
trawl_DExp(x, w, lambda1, lambda2)
trawl_DExp(x, w, lambda1, lambda2)
x |
the argument at which the double exponential trawl function will be evaluated |
w |
parameter in the double exponential trawl |
lambda1 |
the parameter |
lambda2 |
the parameter |
The trawl function is parametrised by parameters
and
as follows:
The double exponential trawl function evaluated at x
Evaluates the exponential trawl function
trawl_Exp(x, lambda)
trawl_Exp(x, lambda)
x |
the argument at which the exponential trawl function will be evaluated |
lambda |
the parameter |
The trawl function is parametrised by parameter as
follows:
The exponential trawl function evaluated at x
Evaluates the long memory trawl function
trawl_LM(x, alpha, H)
trawl_LM(x, alpha, H)
x |
the argument at which the long memory trawl function will be evaluated |
alpha |
the parameter |
H |
the parameter |
The trawl function is parametrised by the two parameters
and
as follows:
the long memory trawl function evaluated at x
Evaluates the supIG trawl function
trawl_supIG(x, delta, gamma)
trawl_supIG(x, delta, gamma)
x |
the argument at which the supIG trawl function will be evaluated |
delta |
the parameter |
gamma |
the parameter |
The trawl function is parametrised by the two parameters and
as follows:
It is assumed that and
are
not simultaneously equal to zero.
The supIG trawl function evaluated at x
Simulates from the trivariate logarithmic series distribution
Trivariate_LSDsim(N, p1, p2, p3)
Trivariate_LSDsim(N, p1, p2, p3)
N |
number of data points to be simulated |
p1 |
parameter |
p2 |
parameter |
p3 |
parameter |
The probability mass function of a random vector
following the trivariate logarithmic series
distribution with parameters
with
is given by
for
such that
.
The simulation proceeds in two steps: First, is simulated from the
modified logarithmic distribution with parameters
and
. Then we
simulate
conditional on
. We note that
follows the bivariate logarithmic series
distribution with parameters
when
, and the
bivariate negative binomial distribution with parameters
when
.
An matrix with
simulated values from the
trivariate logarithmic series distribution