Last data update: 2014.03.03
R: ....
PrecipitationAmountModel R Documentation
....
Description
....
Usage
PrecipitationAmountModel(x, valmin = 1, station = names(x),
sample = "monthly", origin = "1961-1-1", ...)
Arguments
x
observed precipitation amount time series (data
frame)
station
string vector containing station
identification codes
valmin
maximum admitted value of precipitation
depth
origin
date of the day referred by he first row of
x
.
sample
character string. If it is "monthly"
(Default), the corralaton matrix is calculeted per each
month.
...
further agruments for
normalizeGaussian_severalstations
Value
The function returns AN S3 OBJECT ...... the correlation
matrix of precipitation amount values (excluding the
zeros). In case sample=="monthly"
the runction
return a MonlthyList
S3 object.
See Also
predict.PrecipitationAmountModel
,normalizeGaussian_severalstations
Examples
library(RGENERATEPREC)
set.seed(1245)
data(trentino)
year_min <- 1961
year_max <- 1990
origin <- paste(year_min,1,1,sep="-")
end <- paste(year_max,12,31,sep="-")
period <- PRECIPITATION$year>=year_min & PRECIPITATION$year<=year_max
period_temp <- TEMPERATURE_MAX$year>=year_min & TEMPERATURE_MAX$year<=year_max
prec_mes <- PRECIPITATION[period,]
Tx_mes <- TEMPERATURE_MAX[period_temp,]
Tn_mes <- TEMPERATURE_MIN[period_temp,]
accepted <- array(TRUE,length(names(prec_mes)))
names(accepted) <- names(prec_mes)
for (it in names(prec_mes)) {
acc <- TRUE
acc <- (length(which(!is.na(Tx_mes[,it])))==length(Tx_mes[,it]))
acc <- (length(which(!is.na(Tn_mes[,it])))==length(Tn_mes[,it])) & acc
accepted[it] <- (length(which(!is.na(prec_mes[,it])))==length(prec_mes[,it])) & acc
}
valmin <- 1.0
prec_mes <- prec_mes[,accepted]
Tx_mes <- Tx_mes[,accepted]
Tn_mes <- Tn_mes[,accepted]
prec_occurence_mes <- prec_mes>=valmin
station <- names(prec_mes)[!(names(prec_mes) %in% c("day","month","year"))]
precamount <- PrecipitationAmountModel(prec_mes,station=station,origin=origin)
val <- predict(precamount)
prec_gen <- generate(precamount)
month <- adddate(as.data.frame(residuals(precamount$T0090)),origin=origin)$month
#####plot(month,residuals(precamount$T0090))
plot(factor(month),residuals(precamount$T0090))
qqplot(prec_mes$T0083,prec_gen$T0083)
abline(0,1)
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/PrecipitationAmountModel.Rd_%03d_medium.png", width=480, height=480)
> ### Name: PrecipitationAmountModel
> ### Title: ....
> ### Aliases: PrecipitationAmountModel
>
> ### ** Examples
>
> library(RGENERATEPREC)
>
> set.seed(1245)
>
> data(trentino)
>
> year_min <- 1961
> year_max <- 1990
>
> origin <- paste(year_min,1,1,sep="-")
> end <- paste(year_max,12,31,sep="-")
>
> period <- PRECIPITATION$year>=year_min & PRECIPITATION$year<=year_max
> period_temp <- TEMPERATURE_MAX$year>=year_min & TEMPERATURE_MAX$year<=year_max
>
> prec_mes <- PRECIPITATION[period,]
> Tx_mes <- TEMPERATURE_MAX[period_temp,]
> Tn_mes <- TEMPERATURE_MIN[period_temp,]
> accepted <- array(TRUE,length(names(prec_mes)))
> names(accepted) <- names(prec_mes)
> for (it in names(prec_mes)) {
+ acc <- TRUE
+ acc <- (length(which(!is.na(Tx_mes[,it])))==length(Tx_mes[,it]))
+ acc <- (length(which(!is.na(Tn_mes[,it])))==length(Tn_mes[,it])) & acc
+ accepted[it] <- (length(which(!is.na(prec_mes[,it])))==length(prec_mes[,it])) & acc
+
+ }
>
> valmin <- 1.0
> prec_mes <- prec_mes[,accepted]
>
>
>
> Tx_mes <- Tx_mes[,accepted]
> Tn_mes <- Tn_mes[,accepted]
> prec_occurence_mes <- prec_mes>=valmin
>
> station <- names(prec_mes)[!(names(prec_mes) %in% c("day","month","year"))]
>
> precamount <- PrecipitationAmountModel(prec_mes,station=station,origin=origin)
Factor w/ 12 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
chr [1:10] "gamount" "T0014" "T0064" "T0083" "T0090" "T0129" ...
chr [1:10] "gamount" "T0001" "T0064" "T0083" "T0090" "T0129" ...
chr [1:10] "gamount" "T0001" "T0014" "T0083" "T0090" "T0129" ...
chr [1:10] "gamount" "T0001" "T0014" "T0064" "T0090" "T0129" ...
chr [1:10] "gamount" "T0001" "T0014" "T0064" "T0083" "T0129" ...
chr [1:10] "gamount" "T0001" "T0014" "T0064" "T0083" "T0090" ...
chr [1:10] "gamount" "T0001" "T0014" "T0064" "T0083" "T0090" ...
chr [1:10] "gamount" "T0001" "T0014" "T0064" "T0083" "T0090" ...
chr [1:10] "gamount" "T0001" "T0014" "T0064" "T0083" "T0090" ...
>
> val <- predict(precamount)
>
> prec_gen <- generate(precamount)
>
>
>
>
> month <- adddate(as.data.frame(residuals(precamount$T0090)),origin=origin)$month
> #####plot(month,residuals(precamount$T0090))
> plot(factor(month),residuals(precamount$T0090))
>
> qqplot(prec_mes$T0083,prec_gen$T0083)
> abline(0,1)
>
>
>
>
>
> dev.off()
null device
1
>