quant2ecdf: Simulated Values -> Empirical CDFs

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

View source: R/quant2ecdf.R

Description

This function computes ECDFs for user-defined quantiles of the simulated equivalents, with optional plot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
quant2ecdf(sim, ...)
           
## Default S3 method:
quant2ecdf(sim, weights=NULL, byrow=TRUE, 
           quantiles.desired= c(0.05, 0.5, 0.95), plot=TRUE, obs=NULL, 
           quantiles.labels= c("Q5", "Q50", "Q95"), main=NULL, 
           ylab="Probability", col="blue", leg.cex=1.2, leg.pos="bottomright", 
           cex.axis=1.2, cex.main=1.2, cex.lab=1.2, verbose=TRUE, ...)
           
## S3 method for class 'matrix'
quant2ecdf(sim, weights=NULL, byrow=TRUE, 
           quantiles.desired= c(0.05, 0.5, 0.95), plot=TRUE, obs=NULL, 
           quantiles.labels= c("Q5", "Q50", "Q95"), main=NULL, 
           ylab="Probability", col="blue", leg.cex=1.2, leg.pos="bottomright", 
           cex.axis=1.2, cex.main=1.2, cex.lab=1.2, verbose=TRUE, ...)
           
## S3 method for class 'data.frame'
quant2ecdf(sim, weights=NULL, byrow=TRUE, 
           quantiles.desired= c(0.05, 0.5, 0.95), plot=TRUE, obs=NULL, 
           quantiles.labels= c("Q5", "Q50", "Q95"), main=NULL, 
           ylab="Probability", col="blue", leg.cex=1.2, leg.pos="bottomright", 
           cex.axis=1.2, cex.main=1.2, cex.lab=1.2, verbose=TRUE, ...)

Arguments

sim

matrix or data.frame with the simulated equivalents obtained with different parameter sets, which, by default, are stored in columns

weights

numeric vector, values of the weights to be used for computing the quantiles
Omitting the weights argument or specifying NULL or a zero-length vector will result in the usual un-weighted estimates

byrow

logical, indicates whether the computations have to be made for each column or for each row of x When the simulated equivalents are stored in columns, byrow must be TRUE
When the simulated equivalents are stored in rows, byrow must be FALSE

quantiles.desired

numeric vector, quantiles to be computed. Default values are c(.025, .5, .975) ( => 2.5%, 50%, 97.5% )

plot

logical, indicates if a plot with the ECDFs has to be produced

obs

OPTIONAL. Only used when plot=TRUE
Numeric or zoo object with observed values, which are used in the output plot

quantiles.labels

OPTIONAL. Only used when plot=TRUE
character vector, names to quantiles.desired. Default value is c("Q5", "Q50", "Q95")

main

OPTIONAL. Only used when plot=TRUE
title for the plot

ylab

OPTIONAL. Only used when plot=TRUE
title for the y axis. See plot

col

OPTIONAL. Only used when plot=TRUE
specification for the default plotting colour. See par

leg.cex

OPTIONAL. Only used when plot=TRUE
character expansion factor *relative* to current 'par("cex")'. Used for text, and provides the default for 'pt.cex' and 'title.cex' Default value = 1.2

leg.pos

OPTIONAL. Only used when plot=TRUE
keyword to be used to position the legend. See legend

cex.axis

OPTIONAL. Only used when plot=TRUE
numeric, magnification to be used for the axis annotation relative to 'cex'. See par

cex.main

OPTIONAL. Only used when plot=TRUE
numeric, representing the magnification to be used for main titles relative to the current setting of cex

cex.lab

OPTIONAL. Only used when plot=TRUE
numeric, representing the magnification to be used for x and y labels relative to the current setting of 'cex'. See par

verbose

logical, if TRUE, progress messages are printed

...

further arguments passed to the plot function or from other methods

Details

Steps used in this function are:
1) Computation of un-weighted quantiles (e.g., Q5, Q50, Q95) for the simulated equivalents
2) Computation of ECDFs for each desired quantile, by weighting the quantiles of each parameter set by its corresponding weights (or less-formal likelihood in GLUE terminology)

Value

A list whose elements x and ecdf correspond to unique sorted values of sim. If the first CDF estimate is greater than zero, a point (min(sim),0) is placed at the beginning of the estimates

Note

It requires the wtd.Ecdf function from the Hmisc package.

Author(s)

Mauricio Zambrano-Bigiarini, mzb.devel@gmail.com

See Also

wtd.Ecdf, params2ecdf

Examples

1
2
3
4
5
6
7
# random matrix with 100 simulated values (in columns) corresponding to 10
# different behavioural parameter sets
x <- matrix(rnorm(1000), ncol=10, nrow=100)

# empirical CDFs for the quantiles 0.05, 0.5 and 0.95, with equal weight for 
# each parameter set
quant2ecdf(sim=x, weights=1:10, byrow=FALSE) 

hydroPSO documentation built on April 29, 2020, 9:37 a.m.