Last data update: 2014.03.03

R: This return a 'blockmatrix' object containing the gaussian...
CCGammaToBlockmatrixR Documentation

This return a blockmatrix object containing the gaussian cross-correlation matrices.

Description

This return a blockmatrix object containing the gaussian cross-correlation matrices.

Usage

CCGammaToBlockmatrix(data, lag = 0, p = 3, ...)

Arguments

data

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

lag

numeric (expressed as number of days) used for the element [1,1] of the returned blockmatrix.

p

numeric order $p$ of the auto-regeression

...

further argments of CCGamma

Details

This a wrapper for CCGamma with the option only.matrix=TRUE and the function value is transformed into a blockmatrix object.

See Also

CCGamma,continuity_ratio,omega_inv,omega

Examples

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]

p <- 1 ## try p <- 2 !!!
CCGamma <- CCGammaToBlockmatrix(data=prec_mes,lag=0,p=p,tolerance=0.001)

## Not Run in the examples, uncomment to run the following line
# CCGamma_1 <- CCGammaToBlockmatrix(data=prec_mes,lag=1,p=p,tolerance=0.001)


### Alternatively, recommended .....
## Not Run in the examples, uncomment to run the following line
# CCGamma <- CCGammaToBlockmatrix(data=prec_mes,lag=0,p=p+1,tolerance=0.001)

# CCGamma0 <- CCGamma[1:p,1:p]
# CCGamma1 <- CCGamma[(1:p),(1:p)+1]

# CCGamma0_inv <- solve(CCGamma0)


## Not Run in the examples, uncomment to run the following line
#a1 <- blockmatmult(CCGamma0,CCGamma0_inv)
# a2 <- blockmatmult(CCGamma1,CCGamma0_inv)



# CCGamma_1t <- t(CCGamma1)
#CCGamma_0t <- t(CCGamma0)

# A <- t(solve(CCGamma_0t,CCGamma_1t))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(RGENERATEPREC)
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
Loading required package: stringr

Attaching package: 'stringr'

The following object is masked from 'package:strucchange':

    boundary

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/RGENERATEPREC/CCGammaToBlockmatrix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: CCGammaToBlockmatrix
> ### Title: This return a 'blockmatrix' object containing the gaussian
> ###   cross-correlation matrices.
> ### Aliases: CCGammaToBlockmatrix
> 
> ### ** Examples
> 
> 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]
> 
> p <- 1 ## try p <- 2 !!!
> CCGamma <- CCGammaToBlockmatrix(data=prec_mes,lag=0,p=p,tolerance=0.001)
lag
0
Hmm... p0 - first argument - must be a matrix of probabilities!!!
> 
> ## Not Run in the examples, uncomment to run the following line
> # CCGamma_1 <- CCGammaToBlockmatrix(data=prec_mes,lag=1,p=p,tolerance=0.001)
> 
> 
> ### Alternatively, recommended .....
> ## Not Run in the examples, uncomment to run the following line
> # CCGamma <- CCGammaToBlockmatrix(data=prec_mes,lag=0,p=p+1,tolerance=0.001)
> 
> # CCGamma0 <- CCGamma[1:p,1:p]
> # CCGamma1 <- CCGamma[(1:p),(1:p)+1]
> 
> # CCGamma0_inv <- solve(CCGamma0)
> 
> 
> ## Not Run in the examples, uncomment to run the following line
> #a1 <- blockmatmult(CCGamma0,CCGamma0_inv)
> # a2 <- blockmatmult(CCGamma1,CCGamma0_inv)
> 
> 
> 
> # CCGamma_1t <- t(CCGamma1)
> #CCGamma_0t <- t(CCGamma0)
> 
> # A <- t(solve(CCGamma_0t,CCGamma_1t))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>