CoeffYWeq: This function calculates ...

Description Usage Arguments Value Note Author(s) See Also Examples

Description

This function calculates ...

Usage

1
2
CoeffYWeq(data = NULL, CCGamma0 = NULL, CCGamma1 = NULL, p = 1,
  sample = NULL, origin = "1961-01-01", ...)

Arguments

data

data frame or 'zoo' R object containing daily precipitation time series for several gauges (one gauge time series per column). See CCGamma.

CCGamma0

correlation block-matrix with lag of 0 days. Object returned by CCGammaToBlockmatrix. If omitted,default is NULL, it is internally calculated.

CCGamma1

correlation block-matrix with lag of 1 days. Object returned by CCGammaToBlockmatrix. If omitted,default is NULL, it is internally calculated.

p

numeric order $p$ of the auto-regeression, see CCGammaToBlockmatrix

sample

character string indicated if the coefficients must be estimated differently for subset of the year, e.g. monthly. Admitted values are NULL (Default), "all" or "monthly".

origin

character string (yyyy-dd-mm) indicated the date of the first row of "data". It is used if data and sample are not NULL.

...

other arguments of CCGammaToBlockmatrix

Value

A S3 object of class "YuleWalkerCoefficientBlockmatrices" (or "YuleWalkerCoefficientBlockmatricesPerEachMonth" in case sample="monthly") which is a list containing the block matrices A,Sigma_u of the Yule-Walker Equation and the object CCGammaInfo containing probabilities of no precipitation occurence and returned by function CCGamma applied with lag=0. In case sample="monthly") functioion return a "YuleWalkerCoefficientBlockmatricesPerEachMonth", i. e. a list of "YuleWalkerCoefficientBlockmatrices" for each month.

Note

This function uses Yule-Walker equations for VAR to estimate the coefficient block-matrices blockmatrix A and Sigma_u. The input of this function are the correletion block-matrices CCGamma0 and CCGamma1. If they are missing (and then NULL) , they are also calculated from the original dataset (argument data). In this last case, the coefficients can be estiomated differently for each monthly setting sample equal to "monthly".

Author(s)

Emanuele Cordano

See Also

CCGammaToBlockmatrix,generatePrecipitationAmount

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
library(RMRAINGEN)


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 line
# coeff <- CoeffYWeq(data=prec_mes,p=1,tolerance=0.001)

#
#
# Alternatively the coefficients of Vector Auto-Regressive Model
# can be separately calculated for each month

# ## Not Run in the examples, uncomment to run the following line
#origin <- paste(year_min,1,1,sep="-")
#
#

#coeff_monthly <- CoeffYWeq(data=prec_mes,p=1,tolerance=0.001,sample="monthly",origin=origin)

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