generate.blockmatrix: generate

Description Usage Arguments Details See Also Examples

Description

generate

Usage

1
2
3
4
5
6
7
## S3 method for class 'blockmatrix'
generate(x, xprev = NULL, noise = noise, n = 10,
  x.noise.gen = NULL, ...)

## S3 method for class 'blockmatrix'
generate(x, xprev = NULL, noise = noise, n = 10,
  x.noise.gen = NULL, ...)

Arguments

x

blockmatrix S3 object. See CoeffYWeq

...

further arguments

Details

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.

See Also

generate,CCGammaToBlockmatrix,blockmatrix

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
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))

ecor/RMRAINGEN documentation built on May 15, 2019, 8:53 p.m.