Description Usage Arguments Details Value See Also Examples
generate
generate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## S3 method for class 'YuleWalkerCoefficientBlockmatrices'
generate(x, FUN = rnorm,
n = 100, names = NULL, xprev = NULL, names_x = c("A", "Sigma_u",
"CCGammaInfo"), nearPD = TRUE, precipitation.indicator = FALSE, ...)
## S3 method for class 'YuleWalkerCoefficientBlockmatricesPerEachMonth'
generate(x,
FUN = rnorm, year_min = 1961, year_max = 1990, names = NULL,
xprev = NULL, names_x = c("A", "Sigma_u", "CCGammaInfo"), nearPD = TRUE,
precipitation.indicator = FALSE, ...)
## S3 method for class 'CCGammaObject'
generate(x, n = 100, names = NULL, xprev = NULL,
precipitation.indicator = TRUE, ...)
## S3 method for class 'CCGammaObjectListPerEachMonth'
generate(x, year_min = 1961,
year_max = 1990, names = NULL, xprev = NULL,
precipitation.indicator = TRUE, ...)
|
x |
|
FUN |
random function of the probability
distribution used for noise random generation. Default is
|
n |
number of generations requested |
names |
null object or string vectors or names of
the variables to be generated simultaneously. Default is
|
xprev |
null object or initial condition of the
multivariate random process to be generated. Default is
|
names_x |
names of the elements of a
|
nearPD |
logical. If |
precipitation.indicator |
logical value. Default is
|
year_min,year_max |
first and last years of generation period |
... |
additional arguments for |
Implementation of generate
method for
YuleWalkerCoefficientBlockmatrices
or
CCGammaObject
S3 object. It generates a multivarite
random series according using a VAR model with coefficient
obtained by CoeffYWeq
(YuleWalkerCoefficientBlockmatrices
S3 object) .
Alternatively it generates by applying a first-order Markov
Cain from CCGammaObject
S3 Object.
a matrix or a data frame object
CoeffYWeq
,CCGammaToBlockmatrix
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 | library(RMRAINGEN)
set.seed(125)
data(trentino)
year_min <- 1961
year_max <- 1990
period <- PRECIPITATION$year>=year_min & PRECIPITATION$year<=year_max
station <- names(PRECIPITATION)[!(names(PRECIPITATION) %in% c("day","month","year"))]
prec_mes <- PRECIPITATION[period,station]
## removing nonworking stations (e.g. time series with NA)
accepted <- array(TRUE,length(names(prec_mes)))
names(accepted) <- names(prec_mes)
for (it in names(prec_mes)) {
accepted[it] <- (length(which(!is.na(prec_mes[,it])))==length(prec_mes[,it]))
}
prec_mes <- prec_mes[,accepted]
## the dateset is reduced!!!
prec_mes <- prec_mes[,1:2]
## Not Run in the examples, uncomment to run the following lines
# coeff <- CoeffYWeq(data=prec_mes,p=1,tolerance=0.001)
# generation <- generate(coeff,n=10,names=names(prec_mes))
## Not Run in the examples, uncomment to run the following lines
# origin <- paste(year_min,1,1,sep="-")
# coeff_monthly <- CoeffYWeq(data=prec_mes,p=1,tolerance=0.001,sample="monthly",origin=origin)
# generation_monthly <- generate(coeff_monthly,year_min=year_min,year_max=year_max,
# names=names(prec_mes))
### generation with CCGammaObject
# CCGamma <- CCGamma(data=prec_mes,lag=0,tolerance=0.001,only.matrix=FALSE)
# generation_CCGamma <- generate(x=CCGamma,n=100,names=names(prec_mes))
# CCGamma_monthly <- CCGamma(data=prec_mes,lag=0,tolerance=0.001,only.matrix=FALSE,
# sample="monthly",origin=origin)
## generation_CCGamma <- generate(x=CCGamma_monthly,year_min=year_min,year_max=year_max,
## names=names(prec_mes))
|
Loading required package: copula
Loading required package: RGENERATE
Loading required package: RMAWGEN
Loading required package: chron
Loading required package: date
Loading required package: vars
Loading required package: MASS
Loading required package: strucchange
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: sandwich
Loading required package: urca
Loading required package: lmtest
Attaching package: 'vars'
The following object is masked from 'package:copula':
A
Loading required package: blockmatrix
Loading required package: Matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.