SimSMARTA: Simulation of the target stationary processes using the...

Description Usage Arguments Value Examples

View source: R/SimSMARTA.R

Description

Simulation of the target stationary processes using an SMARTA model to simulate the auxiliary Gaussian process and establish the target correlation structure. This model allows also the simulation of a multivariate process.

Usage

1
SimSMARTA(SMARTApar, steps, SMALAG = 512)

Arguments

SMARTApar

A list containing the parameters of the model. The list is constructed by the function "EstSMARTA".

steps

A scalar specifying the length of the time series to be generated.

SMALAG

A scalar specifying the order of the SMARTA model (must be equal to FFTAG and the lengths of ACFs).

Value

A list of the 3 simulated time series (in matrix format - i.e., matrix of dimensions steps x k, where steps denotes the length of generated time series and k the number of processes). X: The final time series at the actual domain with the target marginal distribution and correlation structure; Z: The auxiliary Gaussian time series at the Gaussian domain and; U: The auxiliary uniform time series at the Copula domain (i.e., in [0,1]).

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
32
33
34
35
36
37
38
39
40
41
## Multivariate simulation of 3 stationary processes with specific distribution functions 
## and autocorrelation structures, as well as specific lag-0 cross-correlation matrix.
## Not run: 
set.seed(9)

# Define the target autocorrelation structure of the 3 processes.
ACSs=list()
ACSs[[1]]=csCAS(param=c(0.1,0.7),lag=2^6)
ACSs[[2]]=csCAS(param=c(0.2,1),lag=2^6)
ACSs[[3]]=csCAS(param=c(0.1,0.5),lag=2^6)

# Define the matrix of lag-0 cross-correlation coefficients between the 3 processes.
Cmat=matrix(c(1,0.4,-0.5,
              0.4,1,-0.3,
             -0.5,-0.3,1),ncol=3,nrow=3)

# Define the target distribution functions (ICDF) of the 3 processes
FXs=rep('qmixed',3) # Define that distributions are of zero-inflated type.

# Define the distributions for the continuous part of the processes. 
# In this example, a re-parameterized version of Gen. Gamma distribution is used for the second process.
qgengamma=function(p,scale, shape1, shape2){
  require(VGAM)
  X=qgengamma.stacy(p=p,scale=scale,k=(shape1/shape2),d=shape2)
  return(X)
}

# Define the parameters of the target distributions.
pFXs[[1]]=list(Distr=qbeta,p0=0,shape1=15,shape2=5) # Beta distribution
pFXs[[2]]=list(Distr=qgengamma,p0=0.7,scale=0.12, shape1=1.35, shape2=0.4) # Gen. Gamma
pFXs[[3]]=list(Distr=qnorm,p0=0,mean=15,sd=3) # Normal distribution

# Estimate the parameters of SMARTA model
SMAparam=EstSMARTA(dist=FXs,params=pFXs,ACFs=ACSs,Cmat=Cmat,
                   DecoMethod='cor.smooth',FFTLag = 2^7,
                   NatafIntMethod='GH',NoEval=9,polydeg=8)
                   
# Generate the synthetic series     
simSMARTA=SimSMARTA(SMARTApar=SMAparam,steps=2^14,SMALAG=2^6)

## End(Not run)

itsoukal/anySim documentation built on May 7, 2020, 11:57 p.m.