Description Usage Arguments Value See Also Examples
View source: R/fitdistrForPrecipitation.R
This function calculates the parameters of a parametric
probability distribution by fitting daily precipitation
data for each station and each month. It is a wrapper
function for fitdistr
1 2 |
data |
dataset |
dname |
name of the pobability distribution to be
fitted, e.g. |
start |
initialization configuration of probability
distribution parameters for |
sample |
character string indicated if the
parameters must be estimated differently for subset of
the year, e.g. monthly. Admitted values are |
origin |
character string containing the date
releted to the first row of |
valmin |
threshold precipitation value [mm] for
wet/dry day indicator. If precipitation is lower than
|
... |
further arguments for |
a list containig the fitting parameters: S3
fitdistrForEachStation-class
or
fitdistrForEachStationForEachMonth-class
(sample=="monthly"
) object
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 | 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:3]
fit <- fitdistrForPrecipitation(data=prec_mes,dname="exp",start=NULL,sample=NULL)
origin <- paste(year_min,1,1,sep="-")
fit_monthly <- fitdistrForPrecipitation(data=prec_mes,dname="exp",
start=NULL,sample="monthly",origin=origin)
fit_monthly_gamma <- fitdistrForPrecipitation(data=prec_mes,dname="gamma",
start=NULL,sample="monthly",origin=origin)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.