| simul.farx | R Documentation |
Simulation of functional data with exogenous variables using a Gram-Schmidt basis.
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)
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.exo |
A functional basis expressed as a matrix, as the matrix
created by |
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. |
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 T_n in a
functional space (that we call in the sequel H) using a simple
equation and the given parameters. T_n is of the form
(T_{1n},T_{2n}) where T_{1n} and
T_{2n} are respectively the endogeneous and the exogeneous
parts of the process.
Second step, the process T_n is projected in the canonical
basis using the base and base.exo linear projectors to
give the endogeneous (X_n) and the exogeneous
(Z_n) 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 m_2=m1_2+m2_2). 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:
\left(\begin{array}{cc}%
d.rho.mod & \code{d.a} \cr%
0 & d.rho.exo.mod%
\end{array}\right)%
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:
\left(\varepsilon_{k+1}, \varepsilon_{k+2}, \ldots, %
\varepsilon_{\code{m2}}\right)
where
\varepsilon_{i}=\frac{\code{cst1}}{i^2}+%
\frac{1-\code{cst1}}{e^i}
and k is the position in the d.rho or d.r.ho.exo
diagonal.
In H, C^T, the covariance operator of T_n, is
defined by:
\left(\begin{array}{cc}%
alpha.mod & alpha.conj.mod \cr%
t(alpha.conj.mod) & alpha.exo%
\end{array}\right)%
Where alpha.mod and alpha.exo.mod are modified versions of
m1_2 * alpha and m2_2 * alpha.conj respectively to avoid 0 on their diagonal. More
precisely, the 0 on their diaginals are replaced by:
\left(\epsilon_{k+1}, \epsilon_{k+2}, \ldots, %
\epsilon_{\code{m2b}}\right)
where
\epsilon_{i}=\frac{\code{cst1}}{i}
alpha.exo is a matrix representation of the covariance operator of
T_{2n} 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).
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.
To simulate T_n, the function creates a white noise
E_n having the following covariance operator:
C^T - \rho * C^T * t({\rho})
where t(.) is the transposition operator.
T_n is the computed using the equation:
T_{n+1} = \rho * T_n + E_n
J. Damon, S. Guillas
simul.far.sde, simul.far.wiener,
simul.far, simul.wiener.
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.