simul.farx: FARX(1) process simulation

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/simul.R

Description

Simulation of functional data with exogenous variables using a Gram-Schmidt basis.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
simul.farx(m=12,n=100,base=base.simul.far(24,5),
  base.exo=base.simul.far(24,5),
  d.a=matrix(c(0.5,0),nrow=1,ncol=2),
  alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2),
  d.rho=diag(c(0.45,0.90,0.34,0.45)),
  alpha=diag(c(0.5,0.23,0.018)),
  d.rho.exo=diag(c(0.45,0.90,0.34,0.45)),
  cst1=0.05)
theoretical.coef(m=12,base=base.simul.far(24,5),
  base.exo=NULL,
  d.rho=diag(c(0.45,0.90,0.34,0.45)),
  d.a=NULL,
  d.rho.exo=NULL,
  alpha=diag(c(0.5,0.23,0.018)),
  alpha.conj=NULL,
  cst1=0.05)

Arguments

m

Integer. Number of discretization points.

n

Integer. Number of observations.

base

A functional basis expressed as a matrix, as the matrix created by base.simul.far or with orthonormalization.

base.exo

A functional basis expressed as a matrix, as the matrix created by base.simul.far or with orthonormalization.

d.rho

Numerical matrix. Part of the linear operator in the Gram-Schmidt basis (see details for more informations).

d.a

Numerical matrix. Part of the linear operator in the Gram-Schmidt basis (see details for more informations).

d.rho.exo

Numerical matrix. Part of the linear operator in the Gram-Schmidt basis (see details for more informations).

alpha

Numerical matrix. Part of the linear operator in the Gram-Schmidt basis (see details for more informations).

alpha.conj

Numerical matrix. Part of the linear operator in the Gram-Schmidt basis (see details for more informations).

cst1

Numeric. Perturbation coefficient on the linear operator.

Details

The simul.farx function simulates a FARX(1) process with one endogeneous variable, one exogeneous variable and a strong white noise. To do so, the function uses the fact that a FARX(1) model can be seen as a FAR(1) model in a wider space. Therefore, the method is very similar to the one used by the function simul.far.

The simulation is realized in two steps.

First step, the function compute a FAR(1) process Tn in a functional space (that we call in the sequel H) using a simple equation and the given parameters. Tn is of the form (T1n,T2n) where T1n and T2n are respectively the endogeneous and the exogeneous parts of the process.

Second step, the process Tn is projected in the canonical basis using the base and base.exo linear projectors to give the endogeneous (Xn) and the exogeneous (Zn) variables respectively.

Those two basis need to be orthonormal and wide enought. In the contrary, the function use the orthonormalization function to make it so. Notice that the size of this matrix corresponds to the dimension of the "modelization space" H (let's call it m2=m12+m22). Of course, the larger m2 the better the functionnal approximation is. Whatever, keep in mind that m2=2m is a good compromise, in order to avoid the memory limits.

In H, the linear operator rho is expressed as:

d.rho.mod \code{d.a} \cr 0 d.rho.exo.mod

Where d.rho.mod and d.rho.exo.mod are modified version of the provided d.rho and d.rho.exo respectively to avoid 0 on their diagonal. More precisely, the 0 on their diaginals are replaced by:

(eps(k+1), eps(k+2), …, eps(\code{m2}))

where

eps(i)= \code{cst1}/(i^2)+(1-\code{cst1})/exp(i)

and k is the position in the d.rho or d.r.ho.exo diagonal.

In H, CT, the covariance operator of Tn, is defined by:

alpha.mod alpha.conj.mod \cr t(alpha.conj.mod) alpha.exo

Where alpha.mod and alpha.exo.mod are modified versions of m12 * alpha and m22 * alpha.conj respectively to avoid 0 on their diagonal. More precisely, the 0 on their diaginals are replaced by:

(epsilon(k+1), epsilon(k+2), …, epsilon(\code{m2b}))

where

epsilon(i)= \code{cst1}/i

alpha.exo is a matrix representation of the covariance operator of T2n and is obtained by inverting the following relation:

alpha.conj.mod = d.rho.exo.mod * alpha.conj.mod * t(d.rho.mod) +% d.rho.exo.mod * mod.alpha * t(\code{d.a})

The theoretical.coef function is provided to help the user making comparison. Calling this function with the same parameters that where used in a simulation (realized with simul.farx or simul.far), we obtain the parameters used internaly by the function to make the simulation. Those values can therefore be compared to those obtained with the estimation function far (examples are provided below).

Value

A fdata object containing two variables ("X" the endogeous variable, and "Z" the exogeneous variable) which is a FARX(1) process of length n with p discretization points.

Note

To simulate Tn, the function creates a white noise En having the following covariance operator:

CT - rho * CT t(CT)

where t(.) is the transposition operator. Tn is the computed using the equation:

Tn+1 = rho * Tn + En

Author(s)

J. Damon, S. Guillas

See Also

simul.far.sde, simul.far.wiener, simul.far, simul.wiener.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  # Simulation of a FARX process
  data1 <- simul.farx(m=10,n=400,base=base.simul.far(20,5),
                base.exo=base.simul.far(20,5),
                d.a=matrix(c(0.5,0),nrow=1,ncol=2),
                alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2),
                d.rho=diag(c(0.45,0.90,0.34,0.45)),
                alpha=diag(c(0.5,0.23,0.018)),
                d.rho.exo=diag(c(0.45,0.90,0.34,0.45)),
                cst1=0.0)

  # Modelisation of the FARX process (joined and separate)
  model1 <- far(data1,k=4,joined=TRUE)
  model2 <- far(data1,k=c(3,1),joined=FALSE)

  # Calculation of the theoretical coefficients
  coef.theo <- theoretical.coef(m=10,base=base.simul.far(20,5),
                base.exo=base.simul.far(20,5),
                d.a=matrix(c(0.5,0),nrow=1,ncol=2),
                alpha.conj=matrix(c(0.2,0),nrow=1,ncol=2),
                d.rho=diag(c(0.45,0.90,0.34,0.45)),
                alpha=diag(c(0.5,0.23,0.018)),
                d.rho.exo=diag(c(0.45,0.90,0.34,0.45)),
                cst1=0.0)

  # Joined coefficient
  round(coef(model1),2)
  coef.theo$rho.T

  # Separate coefficient
  round(coef(model2),2)
  coef.theo$rho.X.Z

far documentation built on May 2, 2019, 9:28 a.m.