SimSPARTA: Simulation of the target cyclostationary process using the...

Description Usage Arguments Value Examples

View source: R/SimSPARTA.R

Description

Simulation of the target cyclostationary process using a PAR(p) model (i.e., the SPARTA model of order 1) to simulate the auxiliary cyclostationary Gaussian process to establish the target season-to-season correlation structure.

Usage

1
SimSPARTA(SPARTApar, steps = 1000, stand = 0)

Arguments

SPARTApar

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

steps

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

stand

A boolean (T or F) indicating whether to standardize (or not) the auxiliary Gaussian time series prior to their mapping to the actual domain. The default value is FALSE.

Value

A list of 3 generated time series (in matrix format - i.e., matrix of dimensions k x m, where m denotes the number of sub-seasons and k the number of periods.): 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
## Simulation of univariate cyclostationary process with specific distribution function at each season 
## and specific lag-1 season-to-season correlations.
## Not run: 
set.seed(21)

# Define the number of seasons.
NumOfSeasons=12 # number of months 

# Define the lag-1 season-to-season correlation coefficients (12 values).
rtarget<-c(0.05,0.55,0.45,0.4,0.6,0.75,0.7,0.75,0.5,0.3,0.3,0.2)

# Define the target distribution functions for each season.
# In this example, a re-parameterized version of Gen. Gamma distribution is used.
qgengamma=function(p,scale, shape1, shape2){
  require(VGAM)
  X=qgengamma.stacy(p=p,scale=scale,k=(shape1/shape2),d=shape2)
  return(X)
}

# Or, a re-parameterized version of Burr Type XII distribution.
qburr=function(p,scale,shape1,shape2) {
  require(ExtDist)
  x=ExtDist::qBurr(p=p,b=scale,g=shape1,s=shape2)
  return(x)
}

# Here, we define the target distribution of each season, though being of continuous type,
# as a zero-inflated ones to demonstrate the more general case. Alternatively, the definition
# could be conducted as in the example of EstARTAp function.

FXs<-rep('qmixed',NumOfSeasons) # Define that distributions are of zero-inflated type.

# Define the parameters of the zero-inflated distribution function for each season.
PFXs<-vector("list",NumOfSeasons)
PFXs[[1]]=list(p0=0.0,Distr=qgengamma,scale=47.22,shape1=2.7,shape2=0.97)
PFXs[[2]]=list(p0=0.0,Distr=qgengamma,scale=199.4,shape1=1.74,shape2=3.45)
PFXs[[3]]=list(p0=0.0,Distr=qburr,scale=193.2,shape1=3.07,shape2=2.54)
PFXs[[4]]=list(p0=0.0,Distr=qburr,scale=172.16,shape1=4.42,shape2=2.50)
PFXs[[5]]=list(p0=0.0,Distr=qgengamma,scale=53.40,shape1=4.11,shape2=1.66)
PFXs[[6]]=list(p0=0.0,Distr=qgengamma,scale=0.017,shape1=26.23,shape2=0.51)
PFXs[[7]]=list(p0=0.0,Distr=qgengamma,scale=27.70,shape1=5.15,shape2=5.30)
PFXs[[8]]=list(p0=0.0,Distr=qgengamma,scale=0.33,shape1=30.97,shape2=0.876)
PFXs[[9]]=list(p0=0.0,Distr=qburr,scale=14.46,shape1=7.6,shape2=0.44)
PFXs[[10]]=list(p0=0.0,Distr=qburr,scale=29.36,shape1=2.73,shape2=0.87)
PFXs[[11]]=list(p0=0.0,Distr=qgengamma,scale=53.15,shape1=3.12,shape2=1.4)
PFXs[[12]]=list(p0=0.0,Distr=qgengamma,scale=116.02,shape1=2.21,shape2=1.33)

# Estimate the parameters of SPARTA model.
SPARTApar<-EstSPARTA(s2srtarget=rtarget,dist=FXs,params=PFXs,
            NatafIntMethod='GH',NoEval=9,polydeg=8,nodes=11)
            
# Generate a synthetic series of 10000 length.
simSPARTA<-SimSPARTA(SPARTApar=SPARTApar,steps=10^5)

## End(Not run)

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