Type: Package
Title: Time Series Copula Models
Version: 0.3.9
Date: 2024-02-16
Maintainer: Alexander McNeil <alexanderjmcneil@gmail.com>
Description: Functions for the analysis of time series using copula models. The package is based on methodology described in the following references. McNeil, A.J. (2021) <doi:10.3390/risks9010014>, Bladt, M., & McNeil, A.J. (2021) <doi:10.1016/j.ecosta.2021.07.004>, Bladt, M., & McNeil, A.J. (2022) <doi:10.1515/demo-2022-0105>.
Depends: R (≥ 3.5.0)
License: GPL-3
LazyData: true
RoxygenNote: 7.3.1
Encoding: UTF-8
Imports: methods, stats, graphics, utils, stats4, zoo, xts, FKF, ltsa, rvinecopulib, arfima, Matrix, polynom, kdensity
Collate: 'basic_objects.R' 'armacopula.R' 'sarmacopula.R' 'dvinecopula.R' 'dvinecopula2.R' 'dvinecopula3.R' 'fitting_basic.R' 'margins.R' 'full_models.R' 'vtransforms.R' 'fitting_vtscopula.R' 'helper_vtarma.R' 'data.R'
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2024-02-16 17:17:19 UTC; ajm643
Author: Alexander McNeil [aut, cre], Martin Bladt [aut]
Repository: CRAN
Date/Publication: 2024-02-16 19:10:02 UTC

Akaike Corrected Information Criterion

Description

Akaike Corrected Information Criterion

Usage

AICc(object, ...)

Arguments

object

a fitted model object for which there exists a logLik method to extract the corresponding log-likelihood.

...

optionally more fitted model objects.

Value

If just one object is provided, a numeric value with the corresponding AICC value.

If multiple objects are provided, a data.frame with rows corresponding to the objects and columns representing the number of parameters in the model (df) and the AICC.


Calculate inverse Rosenblatt function

Description

Evaluates the inverse Rosenblatt function for a sequence of pair copulas extracted from an object of class dvinecopula or dvinecopula2.

Usage

IRblatt(pc_list, data, q)

Arguments

pc_list

a list of pair copulas.

data

vector of past data values in order of occurrence.

q

vector of arguments of inverse Rosenblatt function.

Details

To set up the pair copula list, use the functions mklist_dvine for objects of class dvinecopula or mklist_dvine2 for objects of class dvinecopula2.

The vector data containing the past values of the time series must have at least as many elements as the list of pair copulas in pc_list. The elements of data should be in (0,1) and the elements of q in [0,1].

Value

a vector of values with same length as q.


Calculate Rosenblatt function

Description

Evaluates the Rosenblatt function for a sequence of pair copulas extracted from an object of class dvinecopula or dvinecopula2.

Usage

Rblatt(pc_list, data, x)

Arguments

pc_list

a list of pair copulas.

data

vector of past data values in order of occurrence.

x

vector of arguments of Rosenblatt function.

Details

To set up the pair copula list, use the functions mklist_dvine for objects of class dvinecopula or mklist_dvine2 for objects of class dvinecopula2.

The vector data containing the past values of the time series must have at least as many elements as the list of pair copulas in pc_list. The elements of data should be in (0,1) and the elements of x in [0,1].

Value

a vector of values with same length as x.


Calculate Rosenblatt density function

Description

Evaluates the Rosenblatt density function for a sequence of pair copulas extracted from an object of class dvinecopula or dvinecopula2.

Usage

Rblattdens(pc_list, data, x)

Arguments

pc_list

a list of pair copulas.

data

vector of past data values in order of occurrence.

x

vector of arguments of Rosenblatt density function.

Details

To set up the pair copula list, use the functions mklist_dvine for objects of class dvinecopula or mklist_dvine2 for objects of class dvinecopula2.

The vector data containing the past values of the time series must have at least as many elements as the list of pair copulas in pc_list. The elements of data should be in (0,1) and the elements of x in [0,1].

Value

a vector of values with same length as x.


Constructor function for 2-parameter beta v-transform

Description

Constructor function for 2-parameter beta v-transform

Usage

V2b(delta = 0.5, kappa = 1)

Arguments

delta

a value in (0, 1) specifying the fulcrum of the v-transform.

kappa

additional positive parameter of v-transform.

Value

An object of class Vtransform.

Examples

V2b(delta = 0.45, kappa = 1.2)

Constructor function for 2-parameter v-transform

Description

Constructor function for 2-parameter v-transform

Usage

V2p(delta = 0.5, kappa = 1)

Arguments

delta

a value in (0, 1) specifying the fulcrum of the v-transform.

kappa

additional positive parameter of v-transform.

Value

An object of class Vtransform.

Examples

V2p(delta = 0.45, kappa = 1.2)

Constructor function for 3-parameter beta v-transform

Description

Constructor function for 3-parameter beta v-transform

Usage

V3b(delta = 0.5, kappa = 1, xi = 1)

Arguments

delta

a value in (0, 1) specifying the fulcrum of the v-transform.

kappa

additional positive parameter of v-transform.

xi

additional positive parameter of v-transform.

Value

An object of class Vtransform.

Examples

V3b(delta = 0.45, kappa = 1.2, xi = 1.2)

Constructor function for 3-parameter v-transform

Description

Constructor function for 3-parameter v-transform

Usage

V3p(delta = 0.5, kappa = 1, xi = 1)

Arguments

delta

a value in (0, 1) specifying the fulcrum of the v-transform.

kappa

additional positive parameter of v-transform.

xi

additional positive parameter of v-transform.

Value

An object of class Vtransform.

Examples

V3p(delta = 0.45, kappa = 0.8, xi = 1.1)

Constructor function for degenerate v-transform

Description

Constructor function for degenerate v-transform

Usage

Vdegenerate()

Value

An object of class VtransformI.

Examples

Vdegenerate()

Constructor function for linear v-transform

Description

Constructor function for linear v-transform

Usage

Vlinear(delta = 0.5)

Arguments

delta

a value in (0, 1) specifying the fulcrum of the v-transform.

Value

An object of class VtransformI.

Examples

Vlinear(delta = 0.45)

Constructor function for symmetric v-transform

Description

Constructor function for symmetric v-transform

Usage

Vsymmetric()

Value

An object of class VtransformI.

Examples

Vsymmetric()

Class of v-transforms

Description

This is the class of v-transforms. It contains the VtransformI subclass consisting of v-transforms with an analytical expression for the inverse.

Usage

## S4 method for signature 'Vtransform'
show(object)

## S4 method for signature 'Vtransform'
coef(object)

Arguments

object

an object of the class.

Methods (by generic)

Slots

name

a name for the v-transform of class character.

Vtrans

function to evaluate the v-transform.

pars

vector containing the named parameters of the v-transform.

gradient

function to evaluate the gradient of the v-transform.

Examples

V2p(delta = 0.5, kappa = 1.2)

Class of invertible v-transforms

Description

This class inherits from the Vtransform class and contains v-transforms with an analytical expression for the inverse.

Slots

name

a name for the v-transform of class character.

Vtrans

function to evaluate the v-transform.

pars

vector containing the named parameters of the v-transform.

gradient

function to evaluate the gradient of the v-transform.

inverse

function to evaluate the inverse of the v-transform.

Examples

Vlinear(delta = 0.55)

Compute partial autocorrelations from autocorrelations

Description

Compute partial autocorrelations from autocorrelations

Usage

acf2pacf(rho)

Arguments

rho

vector of autocorrelation values (excluding 1).

Value

A vector of partial autocorrelation values with same length as rho.

Examples

rho <- ARMAacf(ar = -0.9, ma = 0.8, lag.max = 50)[-1]
alpha <- acf2pacf(rho)

Transform an armacopula into a dvinecopula or dvinecopula2 object

Description

Transform an armacopula into a dvinecopula or dvinecopula2 object

Usage

arma2dvine(object)

Arguments

object

an object of class armacopula.

Value

An object of class dvinecopula (for AR copulas) or class dvinecopula2 (for MA or ARMA copulas).

Examples

arma2dvine(armacopula(list(ar = 0.5, ma = 0.4)))

Constructor function for ARMA copula process

Description

Constructor function for ARMA copula process

Usage

armacopula(pars = list(ar = 0, ma = 0))

Arguments

pars

list consisting of vector of AR parameters named 'ar' and vector of MA parameters named 'ma'.

Value

An object of class armacopula.

Examples

armacopula(list(ar = 0.5, ma = 0.4))

ARMA copula processes

Description

Class of objects for ARMA copula processes.

Usage

## S4 method for signature 'armacopula'
coef(object)

## S4 method for signature 'armacopula'
show(object)

## S4 method for signature 'armacopula'
sim(object, n = 1000)

## S4 method for signature 'armacopula'
kendall(object, lagmax = 20)

## S4 method for signature 'armacopula'
predict(object, data, x, type = "df")

Arguments

object

an object of the class.

n

length of realization.

lagmax

maximum value of lag.

data

vector of past data values.

x

vector of arguments of prediction function.

type

type of prediction function ("df" for density, "qf" for quantile function or "dens" for density).

Methods (by generic)

Slots

name

name of ARMA copula process.

modelspec

vector containing number of AR and MA parameters.

pars

list consisting of vector of AR parameters named 'ar' and vector of MA parameters named 'ma'.

Examples

sim(armacopula(list(ar = c(0.5, 0.4), ma = -0.8)), n = 1000)
mod <- armacopula(list(ar = 0.95, ma = -0.85))
kendall(mod)

Objective function for ARMA copula process

Description

Objective function for ARMA copula process

Usage

armacopula_objective(theta, modelspec, u)

Arguments

theta

vector of parameters of ARMA process

modelspec

vector containing model order (p,q)

u

vector of data

Value

Value of objective function at parameters.


Transform a fitted armacopula into a fitted dvinecopula or dvinecopula2 object

Description

Transform a fitted armacopula into a fitted dvinecopula or dvinecopula2 object

Usage

armafit2dvine(object)

Arguments

object

an object of class tscopulafit in which the copula is of class armacopula.

Value

An object of class tscopulafit in which the copula is a dvinecopula (for fitted AR copulas) or class dvinecopula2 (for fitted MA or ARMA copulas).


Bitcoin price data 2016-19

Description

Time series of Bitcoin closing prices from 31 December 2015 to 31 December 2019 (1044 values). This permits the calculation of 4 calendar years of returns.

Usage

data(bitcoin)

Format

An object of class "xts".

Examples

data(bitcoin)
plot(bitcoin)
X <- (diff(log(bitcoin))[-1]) * 100
plot(X)

Convert tscopula object to tscm object

Description

Convert tscopula object to tscm object

Usage

## S4 method for signature 'tscopula,tscm'
coerce(from, to = "tsc", strict = TRUE)

Arguments

from

a tscopula object.

to

a tscm object.

strict

logical variable stating whether strict coercion should be enforced.

Value

A tscm object.


Convert tscopulafit object to be tscmfit object

Description

Convert tscopulafit object to be tscmfit object

Usage

## S4 method for signature 'tscopulafit,tscmfit'
coerce(from, to = "tscmfit", strict = TRUE)

Arguments

from

a tscopulafit object.

to

a tscmfit object.

strict

logical variable stating whether strict coercion should be enforced.

Value

A tscmfit object.


CPI inflation data 1959-2020

Description

Time series of US quarterly CPI (consumer price index) data Q4 1959 to Q4 2020 (245 values) for studying inflation. These data were sourced from the OECD webpage and represent the total ‘perspective’ on inflation, including food and energy. They have been based to have a value of 100 in 2015.

Usage

data(cpi)

Format

An object of class "xts".

Examples

data(cpi)
plot(cpi)
X <- (diff(log(cpi))[-1]) * 100
plot(X)

Conditional density of VT-ARMA process

Description

Conditional density of VT-ARMA process

Usage

dcondvtarma(x, tscmmod, armamean, armasd)

Arguments

x

vector of points at which density should be calculated.

tscmmod

an object of class tscmfit based on underlying copula of class armacopula.

armamean

conditional mean of underlying ARMA process.

armasd

conditional standard deviation of underlying ARMA process.

Value

vector with same length as x.


Compute density of marginal model

Description

Compute the density function of the marginal model.

Usage

dmarg(x, y, log = FALSE)

Arguments

x

an object of class margin.

y

vector of values for which density should be computed.

log

logical variable specifying whether log density should be returned.

Value

A vector of values for the density.

Examples

margmod <- margin("gauss", pars = c(mu = 0, sigma = 1))
dmarg(margmod, c(-2, 0, 2), log = TRUE)

Double Weibull distribution

Description

Double Weibull distribution

Usage

ddoubleweibull(x, mu = 0.05, shape = 1, scale = 1, log = FALSE)

pdoubleweibull(q, mu = 0.05, shape = 1, scale = 1)

qdoubleweibull(p, mu = 0.05, shape = 1, scale = 1)

rdoubleweibull(n, mu = 0.05, shape = 1, scale = 1)

Arguments

x

vector of values.

mu

location parameter.

shape

shape parameter.

scale

scale parameter.

log

flag for log density.

q

vector of quantiles.

p

vector of probabilities.

n

number of observations.

Value

A vector of density, distribution function, quantile or random values.


Constructor function for dvinecopula process

Description

This function sets up a stationary d-vine process of finite order where the elements of the (finite-length) copula sequence may be any copulas that can be implemented using bicop_dist in the rvinecopulib package.

Usage

dvinecopula(family = "indep", pars = list(NULL), rotation = 0)

Arguments

family

a vector of family names

pars

a list containing the parameters of the copula at each lag

rotation

a vector of rotations

Details

Copulas may also be rotated through 90, 180 and 270 degrees. If the same family or same rotation is to be used at every lag, these arguments may be scalars. The pars argument must be a list with the same length as the copula sequence.

If a t copula is included, the correlation parameter precedes the degrees of freedom in the parameter vector. This copula should be referred to as "t" rather than "Student".

Value

An object of class dvinecopula.

Examples

dvinecopula(family = c("joe", "gauss", "t"), pars = list(3, .5, c(0.4, 4)), rotation = c(180, 0, 0))

D-vine copula processes

Description

Class of objects for d-vine copula processes.

Usage

## S4 method for signature 'dvinecopula'
coef(object)

## S4 method for signature 'dvinecopula'
show(object)

## S4 method for signature 'dvinecopula'
sim(object, n = 1000, innov = NA, start = NA)

## S4 method for signature 'dvinecopula'
predict(object, data, x, type = "df")

## S4 method for signature 'dvinecopula'
kendall(object, lagmax = 20)

Arguments

object

an object of the class.

n

length of realization.

innov

vector of innovations of length n.

start

vector of start values with length equal to order of process.

data

vector of past data values.

x

vector of arguments of prediction function.

type

type of prediction function ("df" for density, "qf" for quantile function or "dens" for density).

lagmax

maximum value of lag.

Methods (by generic)

Slots

name

name of the d-vine copula process.

modelspec

list containing the family, number of parameters and rotations

pars

list comprising of the parameters.

Examples

sim(dvinecopula("gauss", 0.5))
mixmod <- dvinecopula(family = c("gumbel", "gauss"), pars = list(1.5, -0.6))
kendall(mixmod)

Constructor function for dvinecopula2 process

Description

This function sets up a stationary d-vine process of finite or infinite order based on a single copula family from a subset of those that can be implemented using bicop_dist in the rvinecopulib package.

Usage

dvinecopula2(
  family = "gauss",
  rotation = 0,
  kpacf = "kpacf_arma",
  pars = list(ar = 0.1, ma = 0.1),
  maxlag = Inf,
  negtau = "none"
)

Arguments

family

family name

rotation

a scalar specifying the rotation (default is 0)

kpacf

a character string giving the name of the Kendall pacf

pars

a list containing the parameters of the model

maxlag

a scalar specifying the maximum lag

negtau

a character string specifying the treatment of negative Kendall's tau values

Details

The copula family may be any one-parameter family or the t copula family. The basic copula from which the sequence is built may be rotated through 180 degrees using the rotation argument; the default is no rotation (0 degrees).

The copulas are parameterized using the Kendall partial autocorrelation function (kpacf) specified by the kpacf argument. The default choice is the kpacf of a standard ARMA process which is implemented in the function kpacf_arma. The parameters of the kpacf should be set as a list using the pars argument; the required parameters should usually be clear from the documentation of the chosen kpacf function and must be correctly named.

If the kpacf takes a negative value at any lag and the standard copula is unable to model a negative dependency (e.g. Clayton, Gumbel, Joe and their 180 degree rotations) then one of four different treatments may be specified using the negtau parameter: "gauss" substitutes a Gaussian copula at that lag; "frank" substitutes a Frank copula; "right" and "left" rotate the copula through 90 degrees in a clockwise or anto-clockwise direction respectively.

The maxlag parameter specifies the maximum lag of the process; a finite number gives a finite-order stationary d-vine process, but the parameter may also be set to Inf for an infinite-order process.

If the t copula is chosen by setting family equal to "t", the list of parameters needs to be augmented with a component named "df" which is the degrees of freedom. In this case it makes sense to set maxlag to be a finite number to avoid models with tail dependencies at arbitrary lags which are not ergodic. The class dvinecopula3 is more suitable for working with t copulas with different degrees of freedom at different lags.

Value

An object of class dvinecopula2.

Examples

dvinecopula2(family = "joe", kpacf = "kpacf_arma",
pars = list(ar = 0.95, ma = -0.85), maxlag = 30)

D-vine copula processes of type 2

Description

Class of objects for d-vine copula processes. See dvinecopula2 for more details.

Usage

## S4 method for signature 'dvinecopula2'
coef(object)

## S4 method for signature 'dvinecopula2'
show(object)

## S4 method for signature 'dvinecopula2'
sim(object, n = 1000)

## S4 method for signature 'dvinecopula2'
predict(object, data, x, type = "df")

## S4 method for signature 'dvinecopula2'
kendall(object, lagmax = 20)

Arguments

object

an object of the class.

n

length of realization.

data

vector of past data values.

x

vector of arguments of prediction function.

type

type of prediction function ("df" for density, "qf" for quantile function or "dens" for density).

lagmax

maximum value of lag.

Methods (by generic)

Slots

name

name of the d-vine copula process.

modelspec

list containing the family, rotation, and name of KPACF

pars

list comprising of the parameters.

Examples

copmod <- dvinecopula2(family = "joe", kpacf = "kpacf_arma",
pars = list(ar = 0.95, ma = -0.85), maxlag = 30)
kendall(copmod)

Objective function for dvinecopula2 process

Description

Objective function for dvinecopula2 process

Usage

dvinecopula2_objective(theta, modelspec, u)

Arguments

theta

parameters of kpacf

modelspec

list specifying model

u

data

Value

Value of objective function at parameters.


Constructor function for dvinecopula3 process

Description

This function sets up a stationary d-vine process of finite or infinite order based on a sequence of Gaussian copulas with a finite number of non-Gaussian substitutions at specified lags. The substituted families can be Gumbel, Clayton, Joe, Frank, t and BB1 copulas as implemented by the bicop_dist in the rvinecopulib package.

Usage

dvinecopula3(
  location = 1,
  family = "gumbel",
  posrot = 0,
  negrot = 90,
  kpacf = "kpacf_arma",
  pars = list(ar = 0.1, ma = 0.1),
  auxpar = NA,
  maxlag = Inf
)

Arguments

location

vector of locations of non-Gaussian copula substitutions

family

vector of family names for non-Gaussian copula substitutions

posrot

vector of rotations for substituted families under positive dependence (default is 0)

negrot

vector of rotations for substituted families under negative dependence (default is 90)

kpacf

a character string giving the name of the Kendall pacf

pars

a list containing the parameters of the model

auxpar

vector of additional parameters for two-parameter copulas

maxlag

a scalar specifying the maximum lag

Details

For the substituted copulas (other than t and Frank) the user must specify the rotation that should be used for positive dependencies (0 or 180) and the rotation that should be used for negative dependencies (90 or 270).

The copulas are parameterized using the Kendall partial autocorrelation function (kpacf) specified by the kpacf argument. The default choice is the kpacf of a standard ARMA process which is implemented in the function kpacf_arma. The parameters of the kpacf should be set as a list using the pars argument; the required parameters should usually be clear from the documentation of the chosen kpacf function and must be correctly named.

The maxlag parameter specifies the maximum lag of the process; a finite number gives a finite-order stationary d-vine process, but the parameter may also be set to Inf for an infinite-order process.

If one or more of the substituted copulas are t or BB1 copulas the argument auxpar should be used to specify the additional parameters. These are the degree-of-freedom parameter for t and the delta parameter for BB1; the former must be greater or equal 2 and the latter greater or equal 1.

Value

An object of class dvinecopula3.

Examples

dvinecopula3(location = c(1,4), family = c("Gumbel", "clayton"),
posrot = c(0, 180), negrot = c(90, 270), kpacf = "kpacf_arma",
pars = list(ar = 0.95, ma = 0.85), maxlag = 20)

D-vine copula processes of type 3

Description

Class of objects for d-vine copula processes. See dvinecopula3 for more details.

Usage

## S4 method for signature 'dvinecopula3'
coef(object)

## S4 method for signature 'dvinecopula3'
kendall(object, lagmax = 20)

## S4 method for signature 'dvinecopula3'
show(object)

## S4 method for signature 'dvinecopula3'
sim(object, n = 1000)

## S4 method for signature 'dvinecopula3'
predict(object, data, x, type = "df")

Arguments

object

an object of the class.

lagmax

maximum value of lag.

n

length of realization.

data

vector of past data values.

x

vector of arguments of prediction function.

type

type of prediction function ("df" for density, "qf" for quantile function or "dens" for density).

Methods (by generic)

Slots

name

name of the d-vine copula process.

modelspec

list containing the family, rotation, and name of KPACF

pars

list comprising of the parameters.


Objective function for dvinecopula3 process

Description

Objective function for dvinecopula3 process

Usage

dvinecopula3_objective(theta, modelspec, u)

Arguments

theta

parameters of kpacf

modelspec

list specifying model

u

data

Value

Value of objective function at parameters.


Objective function for dvinecopula process

Description

Objective function for dvinecopula process

Usage

dvinecopula_objective(theta, modelspec, u)

Arguments

theta

parameters of copulas

modelspec

list of families of copulas

u

vector of data

Value

Value of objective function at parameters.


Construct empirical margin

Description

Construct empirical margin

Usage

edf()

Value

An object of class margin signifying an empirical distribution function.


Expand AR coefficients to include SAR coefficients of SARMA model

Description

Expand AR coefficients to include SAR coefficients of SARMA model

Usage

expand_ar(ar, sar, period)

Arguments

ar

vector of AR coefficients

sar

vector of SAR coefficients

period

period of SARMA model

Value

vector of AR coefficients in equivalent ARMA model


Expand MA coefficients to include SMA coefficients of SARMA model

Description

Expand MA coefficients to include SMA coefficients of SARMA model

Usage

expand_ma(ma, sma, period)

Arguments

ma

vector of MA coefficients

sma

vector of SMA coefficients

period

period of SARMA model

Value

vector of MA coefficients in equivalent ARMA model


Generic for estimating time series models

Description

Methods are available for objects of class tscopulaU, vtscopula, tscopulafit, margin and tscm.

Usage

fit(x, y, ...)

Arguments

x

an object of the model class.

y

a vector or time series of data.

...

further arguments to be passed on.

Value

An object of the fitted model class.


Fit method for margin class

Description

Fit method for margin class

Usage

## S4 method for signature 'margin'
fit(x, y, tsoptions = list(), control = list())

Arguments

x

an object of class margin.

y

a vector or time series of data.

tsoptions

list of optional arguments: hessian is logical variable specifying whether Hessian matrix should be returned; start is vector od named starting values

control

list of control parameters to be passed to the optim function.

Value

An object of class marginfit.

Examples

margmod <- margin("gauss", pars = c(mu = 0, sigma = 1))
data <- sim(margmod, n = 500)
fit(margmod, data)

Fit method for tscm class

Description

Fit method for tscm class

Usage

## S4 method for signature 'tscm'
fit(x, y, tsoptions = list(), control = list(), method = "IFM")

Arguments

x

an object of class tscm.

y

a vector or time series of data.

tsoptions

a list of parameters passed to fitting.

control

list of control parameters to be passed to the optim function.

method

character string specifying method.

Value

An object of class tscmfit.

Examples

mod <- tscm(dvinecopula(family = "gauss", pars = 0.5), margin("doubleweibull"))
y <- sim(mod)
fit(mod, y)

Fit method for tscopulaU class

Description

Fit method for tscopulaU class

Usage

## S4 method for signature 'tscopulaU'
fit(x, y, tsoptions = list(), control = list())

Arguments

x

an object of class tscopulaU.

y

vector or time series of data to which the copula process is to be fitted.

tsoptions

list of options

control

list of control parameters to be passed to the optim function.

Value

An object of class tscopulafit.

Examples

data <- sim(armacopula(list(ar = 0.5, ma = 0.4)), n = 1000)
fit(armacopula(list(ar = 0.5, ma = 0.4)), data)

Fit method for tscopulafit class

Description

Fit method for tscopulafit class

Usage

## S4 method for signature 'tscopulafit'
fit(x, y, tsoptions = list(), control = list(warn.1d.NelderMead = FALSE))

Arguments

x

an object of class tscopulafit.

y

vector or time series of data to which the copula process is to be fitted.

tsoptions

list of options

control

list of control parameters to be passed to the optim function.

Value

An object of class tscopulafit.

Examples

ar1 <- armacopula(list(ar = 0.7))
data <- sim(ar1, 1000)
ar1fit <- fit(fit(ar1, data), sim(ar1, 1000))

Fit method for vtscopula class

Description

Fit object of class vtscopula to data using maximum likelihood.

Usage

## S4 method for signature 'vtscopula'
fit(
  x,
  y,
  tsoptions = list(),
  control = list(maxit = 2000, warn.1d.NelderMead = FALSE)
)

Arguments

x

an object of class vtscopula.

y

a vector or time series of data.

tsoptions

list of optional arguments: hessian is logical variable specifying whether Hessian matrix should be returned; method is choice of optimization method.

control

list of control parameters to be passed to the optim function.

Value

An object of class tscopulafit.

Examples

copobject <- armacopula(pars = list(ar = 0.6, ma = 0.2))
vtcop <- vtscopula(copobject, Vtransform = V2p())
y <- sim(vtcop)
fit(vtcop, y)

Fit tscm using empirical distribution function

Description

Fit tscm using empirical distribution function

Usage

fitEDF(x, y, tsoptions, control)

Arguments

x

an object of class tscm.

y

a vector or time series of data.

tsoptions

a list of parameters passed to fitting. This differs according to the class of x.

control

list of control parameters to be passed to the optim function.

Value

An object of class tscmfit.


Fit tscm jointly

Description

Fit tscm jointly

Usage

fitFULLa(x, y, tsoptions, control)

Arguments

x

an object of class tscm.

y

a vector or time series of data.

tsoptions

list of variables

control

list of control parameters to be passed to the optim function.

Value

An object of class tscmfit.


Fit tscm Jointly

Description

Fit tscm Jointly

Usage

fitFULLb(x, y, tsoptions, control)

Arguments

x

an object of class tscm.

y

a vector or time series of data.

tsoptions

list of variables

control

list of control parameters to be passed to the optim function.

Value

An object of class tscmfit.


Fit tscm in two steps

Description

Fit tscm in two steps

Usage

fitSTEPS(x, y, tsoptions, control)

Arguments

x

an object of class tscm.

y

a vector or time series of data.

tsoptions

a list of parameters passed to fitting. This differs according to the class of x.

control

list of control parameters to be passed to the optim function.

Value

An object of class tscmfit.


Gaussian distribution

Description

Gaussian distribution

Usage

dgauss(x, mu = 0, sigma = 1, log = FALSE)

pgauss(q, mu = 0, sigma = 1)

qgauss(p, mu = 0, sigma = 1)

rgauss(n, mu = 0, sigma = 1)

Arguments

x

vector of values.

mu

location parameter.

sigma

scale parameter.

log

flag for log density.

q

vector of quantiles.

p

vector of probabilities.

n

number of observations.

Value

A vector of density, distribution function, quantile or random values.


Centred Gaussian distribution

Description

Centred Gaussian distribution

Usage

dgauss0(x, sigma = 1, log = FALSE)

pgauss0(q, sigma = 1)

qgauss0(p, sigma = 1)

rgauss0(n, sigma = 1)

Arguments

x

vector of values.

sigma

scale parameter.

log

flag for log density.

q

vector of quantiles.

p

vector of probabilities.

n

number of observations.

Value

A vector of density, distribution function, quantile or random values.


Generalized lagging function

Description

Generalized lagging function

Usage

glag(x, lagmax = 20, glagplot = FALSE)

Arguments

x

an object of class tscopulafit.

lagmax

maximum value for lag.

glagplot

logical value indicating generalized lag plot.

Value

If glagplot is TRUE a list of generalized lagged datasets of maximum length 9 is returned to facilitate a generalized lagplot. If glagplot is FALSE a vector of length lagmax containing the Kendall rank correlations for the generalized lagged datasets is returned.


Generalized lagging for fitted armacopula objects

Description

Generalized lagging for fitted armacopula objects

Usage

glag_for_armacopula(copula, data, lagmax, glagplot = FALSE)

Arguments

copula

an armacopula object.

data

the data to which copula is fitted.

lagmax

the maximum lag value.

glagplot

logical value indicating generalized lag plot.

Value

If glagplot is TRUE a list of generalized lagged datasets of maximum length 9 is returned to facilitate a generalized lagplot. If glagplot is FALSE a vector of length lagmax containing the Kendall rank correlations for the generalized lagged datasets is returned.


Generalized lagging for fitted dvinecopula objects

Description

Generalized lagging for fitted dvinecopula objects

Usage

glag_for_dvinecopula(copula, data, lagmax, glagplot = FALSE)

Arguments

copula

a dvinecopula object

data

the data to which copula is fitted

lagmax

the maximum lag value.

glagplot

logical value indicating generalized lag plot.

Value

If glagplot is TRUE a list of generalized lagged datasets of maximum length 9 is returned to facilitate a generalized lagplot. If glagplot is FALSE a vector of length lagmax containing the Kendall rank correlations for the generalized lagged datasets is returned.


Generalized lagging for fitted dvinecopula2 objects

Description

Generalized lagging for fitted dvinecopula2 objects

Usage

glag_for_dvinecopula2(copula, data, lagmax, glagplot = FALSE)

Arguments

copula

a dvinecopula2 object

data

the data to which copula is fitted

lagmax

the maximum lag value.

glagplot

logical value indicating generalized lag plot.

Value

If glagplot is TRUE a list of generalized lagged datasets of maximum length 9 is returned to facilitate a generalized lagplot. If glagplot is FALSE a vector of length lagmax containing the Kendall rank correlations for the generalized lagged datasets is returned.


Generalized lagging for fitted dvinecopula3 objects

Description

Generalized lagging for fitted dvinecopula3 objects

Usage

glag_for_dvinecopula3(copula, data, lagmax, glagplot = FALSE)

Arguments

copula

a dvinecopula3 object

data

the data to which copula is fitted

lagmax

the maximum lag value.

glagplot

logical value indicating generalized lag plot.

Value

If glagplot is TRUE a list of generalized lagged datasets of maximum length 9 is returned to facilitate a generalized lagplot. If glagplot is FALSE a vector of length lagmax containing the Kendall rank correlations for the generalized lagged datasets is returned.


Generalized lagging for fitted sarmacopula objects

Description

Generalized lagging for fitted sarmacopula objects

Usage

glag_for_sarmacopula(copula, data, lagmax, glagplot = FALSE)

Arguments

copula

a sarmacopula object.

data

the data to which copula is fitted.

lagmax

the maximum lag value.

glagplot

logical value indicating generalized lag plot.

Value

If glagplot is TRUE a list of generalized lagged datasets of maximum length 9 is returned to facilitate a generalized lagplot. If glagplot is FALSE a vector of length lagmax containing the Kendall rank correlations for the generalized lagged datasets is returned.


Generic for Kendall correlations

Description

Methods are available for objects of class armacopula, dvinecopula, dvinecopula2 and vtscopula.

Usage

kendall(object, ...)

Arguments

object

an object of the model class.

...

further arguments to be passed to Kendall calculation.

Value

A vector of Kendall correlations.


Kalman filter for ARMA copula model

Description

Kalman filter for ARMA copula model

Usage

kfilter(x, y)

Arguments

x

an object of class armacopula.

y

a vector of data.

Value

A matrix or multivariate time series with columns consisting of conditional mean, standard deviation and residuals.

Examples

data <- sim(armacopula(list(ar = c(0.5, 0.4), ma = -0.8)), n = 1000)
kfilter(armacopula(list(ar = c(0.5, 0.4), ma = -0.8)), data)

KPACF of ARFIMA process

Description

KPACF of ARFIMA process

Usage

kpacf_arfima(k, theta)

Arguments

k

number of lags.

theta

list with components ar, ma and d specifying the ARFIMA parameters

Value

A vector of Kendall partial autocorrelations of length k.


KPACF of ARMA process

Description

KPACF of ARMA process

Usage

kpacf_arma(k, theta)

Arguments

k

number of lags.

theta

list with components ar and ma specifying the ARMA parameters.

Value

A vector of Kendall partial autocorrelations of length k.


KPACF of fractional Brownian noise

Description

KPACF of fractional Brownian noise

Usage

kpacf_fbn(k, theta)

Arguments

k

number of lags

theta

parameter of process

Value

A vector of Kendall partial autocorrelations of length k.


KPACF of monthly seasonal ARMA process

Description

KPACF of monthly seasonal ARMA process

Usage

kpacf_sarma12(k, theta)

Arguments

k

number of lags.

theta

list with components ar, ma, sar and sma specifying the ARMA and seasonal ARMA parameters.

Value

A vector of Kendall partial autocorrelations of length k.


KPACF of quarterly seasonal ARMA process

Description

KPACF of quarterly seasonal ARMA process

Usage

kpacf_sarma4(k, theta)

Arguments

k

number of lags.

theta

list with components ar, ma, sar and sma specifying the ARMA and seasonal ARMA parameters.

Value

A vector of Kendall partial autocorrelations of length k.


Transform Kendall's tau values to copula parameters

Description

Transform Kendall's tau values to copula parameters

Usage

ktau_to_par(family, tau)

Arguments

family

name of copula family

tau

value of Kendall's tau

Value

Scalar value of parameter giving tau for a copula family.


Laplace distribution

Description

Laplace distribution

Usage

dlaplace(x, mu = 0, scale = 1, log = FALSE)

plaplace(q, mu = 0, scale = 1)

qlaplace(p, mu = 0, scale = 1)

rlaplace(n, mu = 0, scale = 1)

Arguments

x

vector of values.

mu

location parameter.

scale

scale parameter.

log

flag for log density.

q

vector of quantiles.

p

vector of probabilities.

n

number of observations.

Value

A vector of density, distribution function, quantile or random values.


Centred Laplace distribution

Description

Centred Laplace distribution

Usage

dlaplace0(x, scale = 1, log = FALSE)

plaplace0(q, scale = 1)

qlaplace0(p, scale = 1)

rlaplace0(n, scale = 1)

Arguments

x

vector of values.

scale

scale parameter.

log

flag for log density.

q

vector of quantiles.

p

vector of probabilities.

n

number of observations.

Value

A vector of density, distribution function, quantile or random values.


Constructor function for margin

Description

Constructor function for margin

Usage

margin(name, pars = NULL)

Arguments

name

character string giving name of distribution

pars

parameters of the distribution

Value

An object of class margin.

Examples

margin("sst")

Marginal model for time series

Description

Class of objects for marginal models for stationary time series. The object is given a name and there must exist functions pname, qname, dname and rname. As well as the parameters of the distribution, dname must have the logical argument log specifying whether log density should be computed.

Usage

## S4 method for signature 'margin'
coef(object)

## S4 method for signature 'margin'
sim(object, n = 1000)

## S4 method for signature 'margin'
show(object)

Arguments

object

an object of the class.

n

length of realization.

Methods (by generic)

Slots

name

name of the marginal model class.

pars

a numeric vector containing the named parameters of the distribution which are passed as arguments to pname, qname, dname and rname.

Examples

new("margin", name = "gauss", pars = c(mu = 0, sigma = 1))
margmod <- margin("gauss", pars = c(mu = 0, sigma = 1))
sim(margmod, n = 500)

Fitted marginal model for time series

Description

Fitted marginal model for time series

Usage

## S4 method for signature 'marginfit'
logLik(object)

Arguments

object

an object of the class.

Methods (by generic)

Slots

margin

an object of class margin.

data

numeric vector or time series of data.

fit

a list containing details of the maximum likelihood fit.


Make list of pair copulas for dvinecopula object

Description

Make list of pair copulas for dvinecopula object

Usage

mklist_dvine(x)

Arguments

x

an object of class dvinecopula

Value

a list of pair copulas


Make list of pair copulas for dvinecopula2 object

Description

Make list of pair copulas for dvinecopula2 object

Usage

mklist_dvine2(x, maxlag, truncate, tol = 1)

Arguments

x

an object of class dvinecopula2

maxlag

maximum possible lag to consider

truncate

logical variable stating whether to truncate copulas with negligible dependence

tol

tolerance for truncation

Value

a list of pair copulas


Make list of pair copulas for dvinecopula3 object

Description

Make list of pair copulas for dvinecopula3 object

Usage

mklist_dvine3(x, maxlag, truncate, tol = 1)

Arguments

x

an object of class dvinecopula3

maxlag

maximum possible lag to consider

truncate

logical variable stating whether to truncate copulas with negligible dependence

tol

tolerance for truncation

Value

a list of pair copulas


Check for invertibility of ARMA process

Description

Check for invertibility of ARMA process

Usage

non_invert(ma)

Arguments

ma

vector of moving average parameters.

Value

A logical variable stating whether ARMA process is invertible.


Check for causality of ARMA process

Description

Check for causality of ARMA process

Usage

non_stat(ar)

Arguments

ar

vector of autoregressive parameters

Value

A logical variable stating whether ARMA process is causal.


Compute autocorrelations from partial autocorrelations

Description

Compute autocorrelations from partial autocorrelations

Usage

pacf2acf(alpha)

Arguments

alpha

vector of partial autocorrelation values.

Value

A vector of autocorrelation values with same length as alpha.

Examples

alpha <- ARMAacf(ar = -0.9, ma = 0.8, lag.max = 50, pacf = TRUE)
rho <- pacf2acf(alpha)

Compute autoregressive coefficients from partial autocorrelations

Description

Compute autoregressive coefficients from partial autocorrelations

Usage

pacf2ar(alpha)

Arguments

alpha

vector of partial autocorrelation values.

Value

A vector of autoregressive coefficients with same length as alpha.

Examples

alpha <- ARMAacf(ar = -0.9, ma = 0.8, lag.max = 50, pacf = TRUE)
phi <- pacf2ar(alpha)

Compute coincidence probability for v-transform

Description

Computes the probability that if we v-transform a uniform random variable and then stochastically invert the v-transform, we get back to the original value.

Usage

pcoincide(x)

Arguments

x

an object of class Vtransform.

Value

The probability of coincidence.

Examples

pcoincide(Vlinear(delta = 0.4))
pcoincide(V3p(delta = 0.45, kappa = 0.5, xi = 1.3))

Conditional distribution function of VT-ARMA Process

Description

Conditional distribution function of VT-ARMA Process

Usage

pcondvtarma(q, tscmmod, armamean, armasd)

Arguments

q

point at which CDF should be calculated.

tscmmod

an object of class tscmfit based on underlying copula of class armacopula.

armamean

conditional mean of underlying ARMA process.

armasd

conditional standard deviation of underlying ARMA process.

Value

a scalar value.


Adjusted empirical distribution function

Description

Adjusted empirical distribution function

Usage

pedf(x, data, proper = FALSE)

Arguments

x

argument of empirical distribution function.

data

vector of data for constructing empirical distribution function.

proper

logical variable which when set to TRUE will return the standard empirical distribution function.

Value

a vector of same length as x


Plot method for Vtransform class

Description

Plots the v-transform as well as its gradient or inverse. Can also plot the conditional probability that a series PIT falls below the fulcrum for a given volatility PIT value v.

Usage

## S4 method for signature 'Vtransform,missing'
plot(
  x,
  type = "transform",
  shading = TRUE,
  npoints = 200,
  lower = 0,
  upper = 1
)

Arguments

x

an object of class Vtransform.

type

type of plot: 'transform' for plot of transform, 'inverse' for plot of inverse, 'gradient' for plot of gradient or 'pdown' for plot of conditional probability.

shading

logical variable specifying whether inadmissible zone for v-transform should be shaded

npoints

number of plotting points along x-axis.

lower

the lower x-axis value for plotting.

upper

the upper x-axis value for plotting

Value

No return value, generates plot.

Examples

plot(Vsymmetric())
plot(V2p(delta = 0.45, kappa = 0.8), type = "inverse")
plot(V2p(delta = 0.45, kappa = 0.8), type = "gradient")

Plot method for marginfit class

Description

Plot method for marginfit class

Usage

## S4 method for signature 'marginfit,missing'
plot(x, bw = FALSE)

Arguments

x

an object of class marginfit.

bw

logical variable specifying whether black-white options should be chosen.

Value

No return value, generates plot.


Plot method for tscmfit class

Description

Plot method for tscmfit class

Usage

## S4 method for signature 'tscmfit,missing'
plot(x, plottype = "residual", bw = FALSE, lagmax = 30)

Arguments

x

an object of class tscmfit.

plottype

type of plot required.

bw

logical variable specifying whether black-white options should be chosen.

lagmax

maximum lag value for dvinecopula2 plots

Value

No return value, generates plot.


Plot method for tscopulafit class

Description

Plot method for tscopulafit class

Usage

## S4 method for signature 'tscopulafit,missing'
plot(x, plottype = "residual", bw = FALSE, lagmax = 30)

Arguments

x

an object of class tscopulafit.

plottype

type of plot required.

bw

logical variable specifying whether black-white options should be chosen.

lagmax

maximum lag value for Kendall plots

Value

No return value, generates plot.

Examples

data <- sim(armacopula(list(ar = 0.5, ma = 0.4)), n = 1000)
fit <- fit(armacopula(list(ar = 0.5, ma = 0.4)), data)
plot(fit)

Plot function for volatility profile plot

Description

Plot function for volatility profile plot

Usage

plot_volprofile(x, bw)

Arguments

x

an object of class tscmfit.

bw

logical variable specifying whether black-white options should be chosen.

Value

No return value, generates plot.


Plot function for volatility proxy plot

Description

Plot function for volatility proxy plot

Usage

plot_volproxy(x, bw)

Arguments

x

an object of class tscmfit.

bw

logical variable specifying whether black-white options should be chosen.

Value

No return value, generates plot.


Compute CDF of marginal model

Description

Compute the cumulative distribution function of the marginal model.

Usage

pmarg(x, q)

Arguments

x

an object of class margin.

q

vector of values at which CDF should be computed.

Value

A vector of values for the CDF.

Examples

margmod <- margin("gauss", pars = c(mu = 0, sigma = 1))
pmarg(margmod, c(-2, 0, 2))

Prediction function for tscm class with empirical margin

Description

Prediction function for tscm class with empirical margin

Usage

predict_empirical(object, data, x, type, qtype, proper)

Arguments

object

an object of the class.

data

vector of past data values.

x

vector of arguments of prediction function.

type

type of prediction function ("df" for density, "qf" for quantile function or "dens" for density).

qtype

type of empirical quantile estimate.

proper

logical variable stating whether the standard empirical distribution function should be used when the margin is empirical; otherwise an improper distribution that is bounded away from 0 and 1 is used.


Profile likelihood for fulcrum parameter

Description

Profile likelihood for fulcrum parameter

Usage

profilefulcrum(
  data,
  tscopula = dvinecopula(family = 1, pars = list(0.1)),
  locations = seq(0, 1, by = 0.1),
  plot = TRUE
)

Arguments

data

a vector or time series of data on (0,1).

tscopula

an object of class tscopulaU or vtscopula.

locations

vector containing locations of different values for fulcrum.

plot

logical values specifying whether plot should be created.

Value

A matrix containing fulcrum values and log likelihood values.

Examples

copobject <- armacopula(pars = list(ar = 0.6, ma = 0.2))
vtcop <- vtscopula(copobject, Vtransform = V2p())
y <- sim(vtcop)
profilefulcrum(y, vtcop)

Conditional quantiles of VT-ARMA process

Description

Conditional quantiles of VT-ARMA process

Usage

qcondvtarma(p, tscmmod, armamean, armasd)

Arguments

p

point at which quantile should be calculated.

tscmmod

an object of class tscmfit based on underlying copula of class armacopula.

armamean

conditional mean of underlying ARMA process.

armasd

conditional standard deviation of underlying ARMA process.

Value

a scalar value.


Compute quantiles of marginal model

Description

Compute the quantile function of the marginal model.

Usage

qmarg(x, p)

Arguments

x

an object of class margin.

p

vector of probabilities for which quantiles should be computed.

Value

A vector of values for the quantile function.

Examples

margmod <- margin("gauss", pars = c(mu = 0, sigma = 1))
qmarg(margmod, c(0.05, 0.5, 0.95))

Quantile calculation method for VT-ARMA models

Description

Quantile calculation method for VT-ARMA models

Usage

## S4 method for signature 'tscmfit'
quantile(x, alpha, last = FALSE)

Arguments

x

an object of class tscmfit based on underlying copula of class armacopula.

alpha

a scalar probability value

last

logical value asserting that only the last volatility prediction should be returned

Value

a vector of the same length as the data embedded in the tscmfit object.


Residual function for armacopula object

Description

Residual function for armacopula object

Usage

resid_armacopula(object, data = NA, trace = FALSE)

Arguments

object

a fitted armacopula object.

data

the data to which copula is fitted.

trace

extract trace instead of residuals.

Value

vector of model residuals


Residual function for dvinecopula object

Description

Residual function for dvinecopula object

Usage

resid_dvinecopula(object, data = NA, trace = FALSE)

Arguments

object

a fitted dvinecopula object.

data

the data to which copula is fitted.

trace

extract trace instead of residuals.

Value

vector of model residuals


Residual function for dvinecopula2 object

Description

Residual function for dvinecopula2 object

Usage

resid_dvinecopula2(object, data = NA, trace = FALSE)

Arguments

object

a fitted dvinecopula2 object.

data

the data to which copula is fitted.

trace

extract trace instead of residuals.

Value

vector of model residuals


Residual function for dvinecopula3 object

Description

Residual function for dvinecopula3 object

Usage

resid_dvinecopula3(object, data = NA, trace = FALSE)

Arguments

object

a fitted dvinecopula3 object.

data

the data to which copula is fitted.

trace

extract trace instead of residuals.

Value

vector of model residuals


Residual function for sarmacopula object

Description

Residual function for sarmacopula object

Usage

resid_sarmacopula(object, data = NA, trace = FALSE)

Arguments

object

a fitted sarmacopula object.

data

the data to which copula is fitted.

trace

extract trace instead of residuals.

Value

vector of model residuals


Calculate standard errors safely

Description

Calculate standard errors safely

Usage

safe_ses(hess)

Arguments

hess

a Hessian matrix from a model fit.

Value

a vector of standard errors.


Transform a sarmacopula object into an armacopula object

Description

Transform a sarmacopula object into an armacopula object

Usage

sarma2arma(object)

Arguments

object

an object of class sarmacopula.

Value

An object of class armacopula.

Examples

sarma2arma(sarmacopula(list(ar = 0.5, ma = 0.4, sar = 0.2, sma = 0.6), period = 4))

Transform a sarmacopula into a dvinecopula2 object

Description

Transform a sarmacopula into a dvinecopula2 object

Usage

sarma2dvine(object)

Arguments

object

an object of class sarmacopula.

Value

An object of class dvinecopula2.

Examples

sarma2dvine(sarmacopula(list(ar = 0.5, ma = 0.4, sar = 0.2, sma = 0.6), period = 4))

Constructor function for SARMA copula process

Description

Constructor function for SARMA copula process

Usage

sarmacopula(pars = list(ar = 0, ma = 0, sar = 0, sma = 0), period = 4)

Arguments

pars

list consisting of vector of AR parameters named 'ar' and vector of MA parameters named 'ma', SAR parameters named 'sar' and vector of SMA parameters named 'sma'.

period

period of seasonal model.

Value

An object of class sarmacopula.

Examples

sarmacopula(list(ar = 0.5, ma = 0.4, sar = 0.2, sma = 0.6), period = 4)

SARMA copula processes

Description

Class of objects for seasonal ARMA copula processes.

Usage

## S4 method for signature 'sarmacopula'
coef(object)

## S4 method for signature 'sarmacopula'
show(object)

## S4 method for signature 'sarmacopula'
sim(object, n = 1000)

## S4 method for signature 'sarmacopula'
kendall(object, lagmax = 20)

## S4 method for signature 'sarmacopula'
predict(object, data, x, type = "df")

Arguments

object

an object of the class.

n

length of realization.

lagmax

maximum value of lag.

data

vector of past data values.

x

vector of arguments of prediction function.

type

type of prediction function ("df" for density, "qf" for quantile function or "dens" for density).

Methods (by generic)

Slots

name

name of seasonal ARMA copula process.

modelspec

vector containing number of AR, MA, SAR and SMA parameters as well as the order D of seasonal differencing.

pars

list consisting of vector of AR parameters named 'ar' and vector of MA parameters named 'ma', SAR parameters named 'sar' and vector of SMA parameters named 'sma'.

Examples

sim(sarma2arma(sarmacopula(list(ar = 0.5, ma = 0.4, sar = 0.2, sma = 0.6), period = 4)))
mod <- sarmacopula(list(ar = 0.5, ma = 0.4, sar = 0.2, sma = 0.6), period = 4)
kendall(mod)

Objective function for SARMA copula process

Description

Objective function for SARMA copula process

Usage

sarmacopula_objective(theta, modelspec, u)

Arguments

theta

vector of parameters of DARMA process

modelspec

vector containing model order (p,q)(P,Q)D

u

vector of data

Value

Value of objective function at parameters.


Skew double Weibull distribution

Description

Skew double Weibull distribution

Usage

dsdoubleweibull(x, mu = 0.05, shape = 1, scale = 1, gamma = 1, log = FALSE)

psdoubleweibull(q, mu = 0.05, shape = 1, scale = 1, gamma = 1)

qsdoubleweibull(p, mu = 0.05, shape = 1, scale = 1, gamma = 1)

rsdoubleweibull(n, mu = 0.05, shape = 1, scale = 1, gamma = 1)

Arguments

x

vector of values.

mu

location parameter.

shape

shape parameter.

scale

scale parameter.

gamma

skewness parameter.

log

flag for log density.

q

vector of quantiles.

p

vector of probabilities.

n

number of observations.

Value

A vector of density, distribution function, quantile or random values.


Set optional choices for tscopula fitting

Description

Set optional choices for tscopula fitting

Usage

setoptions(tsoptions, defaults)

Arguments

tsoptions

a list of options chosen by user.

defaults

a list of defaults specified in function.

Value

the definitive list of options to be used in function.


Extract W-copula

Description

Extract W-copula

Usage

setwcopula(x)

Arguments

x

an object of class tscopula.

Value

A description of the W-copula.


Standard deviation of innovations for armacopula

Description

Uses the function tacvfARMA in the ltsa library.

Usage

sigmastarma(x)

Arguments

x

an object of class armacopula.

Value

The standard deviation of the standardized ARMA innovation distribution.

Examples

sigmastarma(armacopula(list(ar = c(0.5, 0.4), ma = -0.8)))

Generic for simulating time series copula models

Description

Methods are available for objects of class swncopula, armacopula, dvinecopula, dvinecopula2, margin and tscm.

Usage

sim(object, ...)

Arguments

object

an object of the model class.

...

further arguments to be passed to the simulation.

Value

A simulated realization from the time series model.


D-vine simulation helper function

Description

D-vine simulation helper function

Usage

simdvine(pc_list, n, innov, start)

Arguments

pc_list

a list of pair copulas.

n

number of data to be simulated.

innov

vector of innovations of length n.

start

vector of start values with length equal to order of process.

Value

a vector of length n.


Skew Laplace distribution

Description

Skew Laplace distribution

Usage

dslaplace(x, mu = 0.05, scale = 1, gamma = 1, log = FALSE)

pslaplace(q, mu = 0.05, scale = 1, gamma = 1)

qslaplace(p, mu = 0.05, scale = 1, gamma = 1)

rslaplace(n, mu = 0.05, scale = 1, gamma = 1)

Arguments

x

vector of values.

mu

location parameter.

scale

scale parameter.

gamma

skewness parameter.

log

flag for log density.

q

vector of quantiles.

p

vector of probabilities.

n

number of observations.

Value

A vector of density, distribution function, quantile or random values.


Skew Student t distribution

Description

Skew Student t distribution

Usage

psst(q, df = 10, gamma = 1, mu = 0, sigma = 1)

qsst(p, df, gamma, mu, sigma)

dsst(x, df, gamma, mu, sigma, log = FALSE)

rsst(n, df, gamma, mu, sigma)

Arguments

q

vector of quantiles.

df

degrees of freedom.

gamma

skewness parameter.

mu

location parameter.

sigma

scale parameter.

p

vector of probabilities.

x

vector of values.

log

flag for log density.

n

number of observations.

Value

A vector of density, distribution function, quantile or random values.


Student t distribution

Description

Student t distribution

Usage

pst(q, df = 10, mu = 0, sigma = 1)

qst(p, df, mu, sigma)

dst(x, df, mu, sigma, log = FALSE)

rst(n, df, mu, sigma)

Arguments

q

vector of quantiles.

df

degrees of freedom.

mu

location parameter.

sigma

scale parameter.

p

vector of probabilities.

x

vector of values.

log

flag for log density.

n

number of observations.

Value

A vector of density, distribution function, quantile or random values.


Centred Student t distribution

Description

Centred Student t distribution

Usage

pst0(q, df = 10, sigma = 1)

qst0(p, df, sigma)

dst0(x, df, sigma, log = FALSE)

rst0(n, df, sigma)

Arguments

q

vector of quantiles.

df

degrees of freedom.

sigma

scale parameter.

p

vector of probabilities.

x

vector of values.

log

flag for log density.

n

number of observations.

Value

A vector of density, distribution function, quantile or random values.


State space representation for standardized ARMA model

Description

State space representation for standardized ARMA model

Usage

starmaStateSpace(ar, ma, order)

Arguments

ar

vector of ar parameters

ma

vector of ma parameters

order

vector giving order (p,q)

Value

State space representation of ARMA process.


Stochastic inverse of a v-transform

Description

Stochastic inverse of a v-transform

Usage

stochinverse(x, v, tscopula = NULL, tol = .Machine$double.eps^0.75)

Arguments

x

an object of class Vtransform.

v

a vector, matrix or time series with values in [0, 1].

tscopula

a time series copula object.

tol

the desired accuracy (convergence tolerance) that is passed to uniroot if numerical inversion is used.

Value

A vector, matrix or time series with values in [0, 1].

Examples

stochinverse(Vsymmetric(), c(0, 0.25, 0.5, 0.75, 1))

Calculate standardized ranks of data

Description

Calculate standardized ranks of data

Usage

strank(x)

Arguments

x

a vector or time series of data.

Value

A vector or time series of standardized ranks in the interval (0,1)

Examples

strank(rnorm(100))

Constructor function for strict white noise copula process

Description

Constructor function for strict white noise copula process

Usage

swncopula()

Value

Object of class swncopula.

Examples

swncopula()

Strict white noise copula process

Description

Strict white noise copula process

Usage

## S4 method for signature 'swncopula'
sim(object, n = 1000)

## S4 method for signature 'swncopula'
coef(object)

## S4 method for signature 'swncopula'
show(object)

Arguments

object

an object of class swncopula.

n

numeric value for length of simulated realisation.

Methods (by generic)

Examples

sim(swncopula())

Objective function for full of tscopula plus margin model

Description

Objective function for full of tscopula plus margin model

Usage

tsc_objectivea(theta, modelspec, modeltype, dens, cdf, y)

Arguments

theta

vector of parameter values

modelspec

list containing model specification

modeltype

character string giving type of model

dens

marginal density function

cdf

marginal cdf

y

vector of data values

Value

Value of objective function at parameters.


Objective function for full fit with v-transform

Description

Objective function for full fit with v-transform

Usage

tsc_objectiveb(theta, fulcrum, modelspec, modeltype, dens, cdf, vt, wcopula, y)

Arguments

theta

vector of parameters

fulcrum

value for fulcrum

modelspec

list containing model specification

modeltype

character vector giving type of model

dens

marginal density function

cdf

marginal distribution function

vt

v-transform

wcopula

W copula if used

y

vector of data

Value

Value of objective function at parameters.


Constructor function for time series

Description

Constructor function for time series

Usage

tscm(tscopula, margin = new("margin", name = "unif"))

Arguments

tscopula

an object of class tscopula.

margin

an object of class margin.

Value

An object of class tscm.

Examples

tscm(dvinecopula(family = "gauss", pars = 0.5), margin("doubleweibull"))

Full models

Description

Class of objects for composite time series models consisting of stationary copula processes and marginal distributions.

Usage

## S4 method for signature 'tscm'
show(object)

## S4 method for signature 'tscm'
coef(object)

## S4 method for signature 'tscm'
sim(object, n = 1000)

## S4 method for signature 'tscm'
predict(object, data, x, type = "df", qtype = 7, proper = FALSE)

## S4 method for signature 'tscm'
kendall(object, lagmax = 20)

Arguments

object

an object of the class.

n

length of realization.

data

vector of past data values.

x

vector of arguments of prediction function.

type

type of prediction function ("df" for density, "qf" for quantile function or "dens" for density).

qtype

type of empirical quantile estimate.

proper

logical variable stating whether the standard empirical distribution function should be used when the margin is empirical; otherwise an improper distribution that is bounded away from 0 and 1 is used.

lagmax

maximum value of lag.

Methods (by generic)

Slots

tscopula

an object of class tscopula.

margin

an object of class margin.

Examples

mod <- tscm(dvinecopula(family = "gauss", pars = 0.5), margin("doubleweibull"))
sim(mod)

Fitted tscm model

Description

Class of objects for fitted tscm models.

Usage

## S4 method for signature 'tscmfit'
logLik(object)

## S4 method for signature 'tscmfit'
resid(object, trace = FALSE)

## S4 method for signature 'tscmfit'
predict(object, x, type = "df", qtype = 7, proper = FALSE)

Arguments

object

an object of the class.

trace

extract trace instead of residuals.

x

vector of arguments of prediction function.

type

type of prediction function ("df" for density, "qf" for quantile function or "dens" for density).

qtype

type of empirical quantile estimate.

proper

logical variable stating whether the standard empirical distribution function should be used when the margin is empirical; otherwise an improper distribution that is bounded away from 0 and 1 is used.

Methods (by generic)

Slots

tscopula

an object of class tscopula.

margin

an object of class margin.

data

a vector or time series of data to which process has been fitted.

fit

a list containing details of the fit.


Time series copula processes

Description

Class of objects for time series copula processes.


Time series copulas of class tscopulaU

Description

S4 Class union for basic time series copula types. These are armacopula, dvinecopula and dvinecopula2,


Fitted time series copula processes

Description

Class of objects for fitted time series copula processes.

Usage

## S4 method for signature 'tscopulafit'
sim(object, n = 1000)

## S4 method for signature 'tscopulafit'
kendall(object, lagmax = 20)

## S4 method for signature 'tscopulafit'
coef(object)

## S4 method for signature 'tscopulafit'
show(object)

## S4 method for signature 'tscopulafit'
logLik(object)

## S4 method for signature 'tscopulafit'
resid(object, trace = FALSE)

## S4 method for signature 'tscopulafit'
predict(object, x, type = "df")

Arguments

object

an object of class tscopulafit.

n

length of realization.

lagmax

maximum value of lag.

trace

extract trace instead of residuals.

x

vector of arguments of prediction function.

type

type of prediction function ("df" for density, "qf" for quantile function or "dens" for density).

Methods (by generic)

Slots

tscopula

an object of class tscopula.

data

a vector or time series of data.

fit

a list containing details of the fit.

Examples

ar1 <- armacopula(list(ar = 0.7))
data <- sim(ar1, 1000)
ar1fit <- fit(ar1, data)
sim(ar1fit)

Calculate conditional down probability of v-transform

Description

Calculate conditional down probability of v-transform

Usage

vdownprob(x, v)

Arguments

x

an object of class Vtransform.

v

a vector or time series with values in [0, 1].

Value

A vector or time series of values of gradient.

Examples

vdownprob(V2p(delta = 0.55, kapp = 1.2), c(0, 0.25, 0.5, 0.75, 1))

Calculate gradient of v-transform

Description

Calculate gradient of v-transform

Usage

vgradient(x, u)

Arguments

x

an object of class Vtransform.

u

a vector or time series with values in [0, 1].

Value

A vector or time series of values of gradient.

Examples

vgradient(Vsymmetric(), c(0, 0.25, 0.5, 0.75, 1))

Calculate inverse of v-transform

Description

If the Vtransform object is also a VtransformI object (an invertible v-transform) then the analytical inverse is used. Otherwise an inverse is found by numerical root finding with uniroot.

Usage

vinverse(x, v, tol = .Machine$double.eps^0.75)

Arguments

x

an object ofc lass Vtransform.

v

a vector or time series with values in [0, 1].

tol

the desired accuracy (convergence tolerance) that is passed to uniroot if numerical inversion is used.

Value

A vector or time series with values in [0, 1].

Examples

vinverse(Vsymmetric(), c(0, 0.25, 0.5, 0.75, 1))

Extract parameters of vtscopula

Description

Extract parameters of vtscopula

Usage

vtparlist(object)

Arguments

object

an object of class vtscopula.

Value

A list of parameters.


Evaluate a v-transform

Description

Evaluate a v-transform

Usage

vtrans(x, u)

Arguments

x

an object of class Vtransform.

u

a vector or time series with values in [0, 1].

Value

A vector or time series with values in [0, 1].

Examples

vtrans(Vsymmetric(), c(0, 0.25, 0.5, 0.75, 1))

Constructor function for vtscopula object

Description

Constructor function for vtscopula object

Usage

vtscopula(tscopulaU, Vtransform = Vlinear(), Wcopula = swncopula())

Arguments

tscopulaU

an object of class armacopula, dvinecopula or dvinecopula2.

Vtransform

an object of class Vtransform.

Wcopula

an object of class tscopula.

Value

An object of class vtscopula.

Examples

copobject <- armacopula(pars = list(ar = 0.6, ma = 0.2))
vtscopula(copobject, Vtransform = V2p())

Time series copula processes with v-transforms

Description

Class of objects for v-transformed time series copula processes.

Usage

## S4 method for signature 'vtscopula'
show(object)

## S4 method for signature 'vtscopula'
coef(object)

## S4 method for signature 'vtscopula'
predict(object, data, x, type = "df")

## S4 method for signature 'vtscopula'
sim(object, n = 1000)

## S4 method for signature 'vtscopula'
kendall(object, lagmax = 20)

Arguments

object

an object of the class.

data

vector of past data values.

x

vector of arguments of prediction function.

type

type of prediction function ("df" for density, "qf" for quantile function or "dens" for density).

n

length of realization.

lagmax

maximum value of lag.

Methods (by generic)

Slots

Vcopula

object of class tscopulaU.

Vtransform

object of class Vtransform.

Wcopula

object of class tscopula.

Examples

copobject <- armacopula(pars = list(ar = 0.6, ma = 0.2))
sim(vtscopula(copobject, Vtransform = V2p()))
mod <- vtscopula(armacopula(list(ar = 0.95, ma = -0.85)))
kendall(mod)

Objective function for vtscopula fitting

Description

Objective function for vtscopula fitting

Usage

vtscopula_objective(theta, fulcrum, modelspec, modeltype, vt, wcopula, y)

Arguments

theta

vector of parameters

fulcrum

fixed value for fulcrum

modelspec

list containing tscopula specification

modeltype

character vector specifying tscopula type

vt

a v transform

wcopula

W copula for serial dependence

y

vector of data

Value

Value of objective function at parameters.


Additional objective for generalized processes

Description

Additional objective for generalized processes

Usage

wobjective(theta, paircop, theta_vt, vtgrad, u)

Arguments

theta

parameter of W copula

paircop

specification of W copula

theta_vt

parameter(s) of v-transform

vtgrad

gradient of v-transform

u

vector of data

Value

Value of additional objective for W-copula.