Skip to contents

Computes empirical cumulative distribution functions (ECDFs) for model parameters from an ensemble of calibrated or behavioural parameter sets, with optional weighting and plotting.

This function is especially useful in hydrology when analysing the parameter space sampled during calibration or uncertainty analysis with hydroPSO. The resulting ECDFs help identify well-constrained parameters, parameter ranges that are consistently supported by behavioural simulations, and the extent to which prior expectations or reference values agree with the calibrated ensemble.

Usage

params2ecdf(params, ...)

# Default S3 method
params2ecdf(params, param.names=NULL, gofs=NULL, MinMax=NULL,
        beh.thr=NA, weights=NULL, byrow=FALSE, plot=TRUE, obs=NULL, main=NULL,
        nrows="auto", ylab="Probability", col="blue", leg.cex=1.2,
        leg.pos="topleft", cex.axis=1.2, cex.main=1.2, cex.lab=1.2,
        verbose=TRUE, ..., do.png=FALSE, png.width=1500, png.height=900,
        png.res=90, png.fname="Params_ECDFs.png")

# S3 method for class 'matrix'
params2ecdf(params, param.names=colnames(params), gofs=NULL,
        MinMax=NULL, beh.thr=NA, weights=NULL, byrow=FALSE, plot=TRUE,
        obs=NULL, main=NULL, nrows="auto", ylab="Probability", col="blue",
        leg.cex=1.2, leg.pos="topleft", cex.axis=1.2, cex.main=1.2,
        cex.lab=1.2, verbose=TRUE, ..., do.png=FALSE, png.width=1500,
        png.height=900, png.res=90, png.fname="Params_ECDFs.png")

# S3 method for class 'data.frame'
params2ecdf(params, param.names=colnames(params), gofs=NULL,
        MinMax=NULL, beh.thr=NA, weights=NULL, byrow=FALSE, plot=TRUE,
        obs=NULL, main=NULL, nrows="auto", ylab="Probability", col="blue",
        leg.cex=1.2, leg.pos="topleft", cex.axis=1.2, cex.main=1.2,
        cex.lab=1.2, verbose=TRUE, ..., do.png=FALSE, png.width=1500,
        png.height=900, png.res=90, png.fname="Params_ECDFs.png")

Arguments

params

A matrix or data frame with parameter values from multiple model runs. Each row should contain one parameter set, and each column should contain the sampled values of one model parameter.

param.names

Character vector with the names to be used for the parameters in params. By default, the column names of params are used.

gofs

Optional numeric vector with one goodness-of-fit value for each parameter set in params. This is required when beh.thr is used to retain only behavioural parameter sets.

MinMax

Optional character string indicating whether better model performance corresponds to minimising or maximising the objective function in gofs. This argument is only used together with beh.thr to select behavioural parameter sets.

Valid values are "min" and "max".

beh.thr

Optional numeric threshold used to retain only behavioural parameter sets. If MinMax="max", parameter sets with gofs >= beh.thr are retained. If MinMax="min", parameter sets with gofs <= beh.thr are retained.

The default beh.thr=NA means that all parameter sets are used.

weights

Optional numeric vector with one weight for each row of params. These weights are passed to wtd.Ecdf to compute weighted ECDFs.

Omitting weights, or providing NULL or a zero-length vector, yields the usual unweighted ECDFs.

byrow

Logical value kept for interface compatibility. In the current implementation, the calculations are performed column-wise, so params should be organised with parameter sets in rows and parameters in columns.

plot

Logical value indicating whether a plot of the ECDF for each parameter should be produced.

obs

Optional numeric or zoo object with one reference value for each parameter. When plot=TRUE, these values are drawn as vertical reference lines to facilitate visual comparison between observed, target, or preferred parameter values and the parameter ensemble.

main

Optional overall title for the plot.

nrows

Optional number of rows in the plotting layout when plot=TRUE. If nrows="auto", the layout is chosen automatically from the number of parameters.

ylab

Optional label for the y axis. See plot.

col

Optional plotting colour used for the ECDF curves. See par.

leg.cex

Optional character expansion factor for legends when plot=TRUE.

leg.pos

Optional keyword controlling the legend position. See legend.

cex.axis

Optional magnification for axis annotation relative to the current cex setting.

cex.main

Optional magnification for main titles relative to the current cex setting.

cex.lab

Optional magnification for x and y labels relative to the current cex setting.

verbose

Logical value. If TRUE, progress messages are printed.

...

Further arguments passed to plot or to other methods.

do.png

Logical value indicating whether the figures should be written to PNG files instead of the active graphics device.

png.width

Optional width of the PNG device in pixels when do.png=TRUE. See png.

png.height

Optional height of the PNG device in pixels when do.png=TRUE. See png.

png.res

Optional nominal resolution in ppi for the PNG device when do.png=TRUE. See png.

png.fname

Optional file name used to store the PNG output when do.png=TRUE.

Value

A list with one element per parameter, where the number of parameters is the number of columns in params.

Each list element is the object returned by wtd.Ecdf for the corresponding parameter. These objects contain the information required to inspect, plot, or interpolate the empirical cumulative distribution of each parameter.

If plot=TRUE, one or more figures are also produced. At most 21 parameters are shown per figure, so the number of figures is ceiling(nparam/21).

References

In hydrological calibration and uncertainty analysis, empirical cumulative distributions are useful for diagnosing parameter identifiability, comparing prior and posterior parameter support, and summarising behavioural ensembles.

Author

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

Examples


# Example 1: ECDFs of calibrated parameters from an ensemble of behavioural runs
set.seed(123)
params <- matrix(runif(600), nrow=100, ncol=6)
colnames(params) <- c("Kq", "Ks", "Alpha", "Beta", "Kperc", "Smax")

# Unweighted ECDFs for all parameters
pe <- params2ecdf(params, plot=FALSE)
#> [ Computing the ECDF for 'Kq   ' , 1/6 => 16.67% ]
#> [ Computing the ECDF for 'Ks   ' , 2/6 => 33.33% ]
#> [ Computing the ECDF for 'Alpha' , 3/6 => 50.00% ]
#> [ Computing the ECDF for 'Beta ' , 4/6 => 66.67% ]
#> [ Computing the ECDF for 'Kperc' , 5/6 => 83.33% ]
#> [ Computing the ECDF for 'Smax ' , 6/6 => 100.00% ]
str(pe[[1]])
#> List of 2
#>  $ x   : num [1:101] 0.000625 0.000625 0.024614 0.04206 0.045556 ...
#>  $ ecdf: Named num [1:101] 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 ...
#>   ..- attr(*, "names")= chr [1:101] "" "0.000624773325398564" "0.0246136845089495" "0.0420595335308462" ...

# \donttest{
# Example 2: Weighted ECDFs using likelihood-based weights
# Useful when some parameter sets are more plausible than others
w <- rexp(100)
w <- w / sum(w)
params2ecdf(params, weights=w, plot=TRUE,
            main="Weighted ECDFs of behavioural parameter sets")
#> [ Computing the weighted ECDF for 'Kq   ' , 1/6 => 16.67% ]
#> [ Computing the weighted ECDF for 'Ks   ' , 2/6 => 33.33% ]
#> [ Computing the weighted ECDF for 'Alpha' , 3/6 => 50.00% ]
#> [ Computing the weighted ECDF for 'Beta ' , 4/6 => 66.67% ]
#> [ Computing the weighted ECDF for 'Kperc' , 5/6 => 83.33% ]
#> [ Computing the weighted ECDF for 'Smax ' , 6/6 => 100.00% ]

#> $Kq
#> $Kq$x
#>   [1] 0.0006247733 0.0006247733 0.0246136845 0.0420595335 0.0455564994
#>   [6] 0.0458311667 0.0935949867 0.0948406609 0.1028646443 0.1029246827
#>  [11] 0.1111354243 0.1218992600 0.1275316502 0.1306956916 0.1388060634
#>  [16] 0.1428000224 0.1471136473 0.1524447477 0.1750526503 0.1876911193
#>  [21] 0.2065313896 0.2164079358 0.2201188852 0.2316257854 0.2330340995
#>  [26] 0.2436194727 0.2460877344 0.2659726404 0.2743836446 0.2875775201
#>  [31] 0.2891597373 0.3181810076 0.3203732425 0.3279207193 0.3435164723
#>  [36] 0.3517979092 0.3688454509 0.3744627759 0.3798165377 0.3839696378
#>  [41] 0.4089769218 0.4137243263 0.4145463358 0.4176467797 0.4348927415
#>  [46] 0.4398316876 0.4422000742 0.4485163414 0.4533341562 0.4566147353
#>  [51] 0.4659624503 0.4667790416 0.4753165741 0.4777959711 0.5115054599
#>  [56] 0.5281054880 0.5440660247 0.5514350145 0.5609479838 0.5726334020
#>  [61] 0.5941420204 0.6127710033 0.6292211316 0.6405068138 0.6531019250
#>  [66] 0.6557057991 0.6567581280 0.6651151946 0.6680555874 0.6775706355
#>  [71] 0.6907052784 0.6928034062 0.7085304682 0.7101824014 0.7533078643
#>  [76] 0.7544751586 0.7584595375 0.7822943013 0.7881958340 0.7883051354
#>  [81] 0.7943423211 0.7954674177 0.7989248456 0.8100643530 0.8123895095
#>  [86] 0.8146400389 0.8578277153 0.8830174040 0.8864690608 0.8895393161
#>  [91] 0.8924190444 0.8930511144 0.8950453592 0.8998249704 0.9022990451
#>  [96] 0.9404672843 0.9545036491 0.9568333453 0.9630242325 0.9849569800
#> [101] 0.9942697766
#> 
#> $Kq$ecdf
#>   [1] 0.00000000 0.01157799 0.01646310 0.02757627 0.03380921 0.04708646
#>   [7] 0.04875591 0.05135944 0.05569259 0.06101180 0.06173396 0.08106969
#>  [13] 0.08746690 0.11983945 0.13697513 0.14364919 0.14607779 0.14712983
#>  [19] 0.16232134 0.18339636 0.18754413 0.18792153 0.19810160 0.20867914
#>  [25] 0.24489735 0.24896624 0.27909644 0.30285151 0.31740576 0.33230472
#>  [31] 0.33290931 0.33296548 0.33867125 0.34628241 0.35573139 0.36244975
#>  [37] 0.38445557 0.40137344 0.40445635 0.40522043 0.42239212 0.44404805
#>  [43] 0.44996653 0.48790332 0.50493914 0.51202424 0.51370993 0.51531358
#>  [49] 0.51922229 0.54457746 0.54498911 0.56103686 0.57912706 0.58231159
#>  [55] 0.60380341 0.61362588 0.61543828 0.61794417 0.62763761 0.62793312
#>  [61] 0.63370458 0.63813445 0.64037408 0.64776446 0.64964474 0.65580502
#>  [67] 0.65634444 0.66330443 0.66740619 0.67232865 0.68097374 0.68763386
#>  [73] 0.70080844 0.70170511 0.70539078 0.74350669 0.74807676 0.75184338
#>  [79] 0.76498464 0.77432415 0.78339921 0.78561186 0.79153534 0.80801498
#>  [85] 0.83331876 0.84131467 0.84928319 0.85510498 0.85511296 0.86011789
#>  [91] 0.87160799 0.87748438 0.87791577 0.88950813 0.91312422 0.92815579
#>  [97] 0.93019388 0.96759856 0.97234276 0.98157868 1.00000000
#> 
#> 
#> $Ks
#> $Ks$x
#>   [1] 0.01046711 0.01046711 0.06072057 0.07669117 0.09104400 0.11109646
#>   [7] 0.14190691 0.14229430 0.14709469 0.15234662 0.15420230 0.18382849
#>  [13] 0.18384952 0.21689276 0.21799067 0.21976763 0.22110294 0.23116178
#>  [19] 0.23909996 0.24572368 0.24644899 0.26501781 0.26503273 0.26568669
#>  [25] 0.27416662 0.30122890 0.30772001 0.31170220 0.31244816 0.31982062
#>  [31] 0.32148276 0.33282354 0.35390457 0.35544538 0.36948887 0.37223806
#>  [37] 0.37471396 0.38790903 0.38999444 0.40451028 0.40683259 0.40947495
#>  [43] 0.41068978 0.41274612 0.43943154 0.44476800 0.46653270 0.48128980
#>  [49] 0.48290240 0.48861303 0.49752727 0.50229956 0.52113573 0.52983569
#>  [55] 0.53368795 0.54928466 0.56459043 0.57193531 0.57286706 0.58175010
#>  [61] 0.58548335 0.59434319 0.59998896 0.60873498 0.61801787 0.61925648
#>  [67] 0.61999331 0.62997305 0.64789348 0.64998516 0.65923032 0.65983845
#>  [73] 0.66828465 0.67299909 0.69000710 0.70829032 0.72059627 0.73213521
#>  [79] 0.73707774 0.74033436 0.74656800 0.78628155 0.82180546 0.83976776
#>  [85] 0.84272932 0.84745317 0.86364411 0.87468234 0.89035022 0.89139412
#>  [91] 0.90187439 0.91318822 0.91443819 0.93529980 0.93731409 0.94772694
#>  [97] 0.95409124 0.95447383 0.97982192 0.98421920 0.98564088
#> 
#> $Ks$ecdf
#>   [1] 0.00000000 0.02165593 0.02657839 0.02699004 0.03276151 0.04245495
#>   [7] 0.04305954 0.05465189 0.08000706 0.09605481 0.09786720 0.10010683
#>  [13] 0.12211266 0.12579832 0.14271618 0.16113751 0.18644128 0.20357696
#>  [19] 0.23979518 0.26355025 0.28288598 0.29602724 0.30526315 0.31234825
#>  [25] 0.34472081 0.34862952 0.35601990 0.36269395 0.36679571 0.37345583
#>  [31] 0.37533611 0.38467562 0.38727915 0.39527506 0.40143535 0.40451827
#>  [37] 0.41907251 0.42499599 0.42914376 0.43118184 0.43494846 0.44086693
#>  [43] 0.44337283 0.45244789 0.46302543 0.46345682 0.48453184 0.50156766
#>  [49] 0.51659923 0.53377092 0.53545661 0.54241659 0.54730171 0.55173157
#>  [55] 0.55333522 0.58346543 0.58934181 0.59573902 0.61723083 0.61795299
#>  [61] 0.62556416 0.62989731 0.64479628 0.65628638 0.66646645 0.67121065
#>  [67] 0.67175007 0.70986599 0.71487091 0.71563499 0.71730444 0.72048898
#>  [73] 0.73857918 0.74722427 0.74965287 0.78758967 0.79290888 0.80087739
#>  [79] 0.80309004 0.81956968 0.83114767 0.83152507 0.83609515 0.84016404
#>  [85] 0.84121607 0.85449332 0.85538999 0.86210835 0.86834130 0.89195740
#>  [91] 0.90714891 0.90715689 0.91697937 0.95438405 0.96008981 0.96038532
#>  [97] 0.97149848 0.97732028 0.97737645 0.99055103 1.00000000
#> 
#> 
#> $Alpha
#> $Alpha$x
#>   [1] 0.006300784 0.006300784 0.020024301 0.047663627 0.052843943 0.054629109
#>   [7] 0.057958561 0.058478489 0.064928300 0.071904097 0.072057124 0.074384513
#>  [13] 0.099041829 0.100721582 0.103599645 0.137106081 0.152887223 0.164211225
#>  [19] 0.168060811 0.170645235 0.171698494 0.172171746 0.197744737 0.216254790
#>  [25] 0.221787935 0.224985329 0.225886433 0.238726027 0.252964929 0.257216746
#>  [31] 0.260856857 0.267521432 0.282528330 0.288239281 0.297741783 0.311869747
#>  [37] 0.336331206 0.347324631 0.351888638 0.364091865 0.395220135 0.395892688
#>  [43] 0.396584595 0.397151953 0.398939825 0.402573342 0.404399181 0.408943998
#>  [49] 0.428421509 0.466472377 0.471576278 0.477845380 0.482042606 0.502813046
#>  [55] 0.515029727 0.516444894 0.531070399 0.542080367 0.546826157 0.560253264
#>  [61] 0.576519021 0.593045652 0.601365726 0.618351227 0.633055360 0.648818124
#>  [67] 0.662317642 0.670282040 0.674186843 0.674376388 0.686375082 0.698261595
#>  [73] 0.700853087 0.724554346 0.726702539 0.728394428 0.735184306 0.754247402
#>  [79] 0.758593170 0.770334074 0.785291671 0.798831611 0.803418542 0.816605888
#>  [85] 0.820951324 0.831927563 0.868106807 0.871043414 0.880246541 0.880440569
#>  [91] 0.881977559 0.915683538 0.918857348 0.925707956 0.950166979 0.961104794
#>  [97] 0.962358936 0.967398371 0.969356411 0.971875636 0.982140374
#> 
#> $Alpha$ecdf
#>   [1] 0.000000000 0.002239633 0.011314699 0.016633906 0.022794194 0.022802170
#>   [7] 0.027135319 0.029347966 0.038583880 0.048032851 0.048929525 0.055647890
#>  [13] 0.071695637 0.073575917 0.075245371 0.079347137 0.079403307 0.090981295
#>  [19] 0.097378499 0.099884395 0.121540326 0.146895496 0.151465569 0.156388026
#>  [25] 0.158073711 0.171214972 0.177091362 0.191990331 0.195899045 0.209176289
#>  [31] 0.214061406 0.233397138 0.238402064 0.249892170 0.282264722 0.283316757
#>  [37] 0.299796396 0.325100170 0.355230373 0.365052852 0.378227432 0.395263251
#>  [43] 0.433200049 0.436384582 0.472602794 0.487634364 0.491320029 0.502433192
#>  [49] 0.526049289 0.530479154 0.530910546 0.532722938 0.570127617 0.577212717
#>  [55] 0.583034512 0.591030430 0.600723871 0.609368964 0.616043016 0.621814479
#>  [61] 0.623418127 0.629341607 0.646513297 0.651257502 0.673263326 0.673985488
#>  [67] 0.679903961 0.695095476 0.695859553 0.696155060 0.714576384 0.715180974
#>  [73] 0.726773328 0.743909012 0.751877527 0.759267902 0.769447971 0.775153736
#>  [79] 0.779222624 0.797312824 0.801460587 0.822952397 0.833529934 0.854604955
#>  [85] 0.862216121 0.862593527 0.879511389 0.917627302 0.923860248 0.924399667
#>  [91] 0.927003197 0.929431803 0.931469887 0.938429871 0.952984115 0.959644232
#>  [97] 0.968983737 0.992738808 0.993150463 0.996233381 1.000000000
#> 
#> 
#> $Beta
#> $Beta$x
#>   [1] 0.008215520 0.008215520 0.009429905 0.017765812 0.033727773 0.034874804
#>   [7] 0.055301926 0.094962413 0.101058494 0.103806688 0.105417746 0.117913841
#>  [13] 0.119404780 0.136540197 0.143817044 0.147048325 0.156636851 0.163070329
#>  [19] 0.185296442 0.192815947 0.193378680 0.208876349 0.210487079 0.225073351
#>  [25] 0.229244840 0.237749405 0.239594629 0.270544872 0.282218417 0.286285349
#>  [31] 0.295895455 0.296302175 0.308119554 0.308786833 0.314270780 0.323344993
#>  [37] 0.338391284 0.342808802 0.353986103 0.354783098 0.363300544 0.370214798
#>  [43] 0.372709394 0.388319115 0.389587112 0.406607866 0.414735334 0.418915897
#>  [49] 0.421844950 0.452458394 0.455108051 0.464665942 0.480910830 0.483167669
#>  [55] 0.486411764 0.492293329 0.492566548 0.515071808 0.526029660 0.533764874
#>  [61] 0.537677183 0.584900093 0.617235270 0.621902295 0.623297546 0.630131853
#>  [67] 0.641462354 0.643922915 0.668771517 0.697373766 0.703992061 0.713279001
#>  [73] 0.725983027 0.729390652 0.737797403 0.760823625 0.769193911 0.774591542
#>  [79] 0.779065883 0.783946479 0.784575267 0.785687834 0.802812273 0.834054309
#>  [85] 0.835255320 0.835708837 0.853763374 0.856885420 0.866483315 0.896738683
#>  [91] 0.913995450 0.915063762 0.963843332 0.967469494 0.971342450 0.977098996
#>  [97] 0.977853405 0.983350181 0.985954165 0.991236556 0.999404528
#> 
#> $Beta$ecdf
#>   [1] 0.00000000 0.01149011 0.02082961 0.04613338 0.05930796 0.06507943
#>   [7] 0.06537493 0.06538291 0.06705236 0.07321265 0.07891842 0.09496616
#>  [13] 0.10088464 0.11416188 0.12112186 0.12851224 0.13833472 0.15767045
#>  [19] 0.16690637 0.16950989 0.18598953 0.19041940 0.20561091 0.22761674
#>  [25] 0.25137181 0.26248497 0.28355999 0.28732661 0.29320300 0.31681910
#>  [31] 0.32347922 0.32535950 0.33991374 0.34663211 0.35151722 0.35194861
#>  [37] 0.35255320 0.35479284 0.36240400 0.36772321 0.37571913 0.39285481
#>  [43] 0.43079161 0.43120326 0.46860794 0.47768301 0.48435706 0.48804273
#>  [49] 0.52615864 0.52866454 0.54024252 0.54415124 0.55038418 0.55746928
#>  [55] 0.55852132 0.58387649 0.58706102 0.59298450 0.61464043 0.63273063
#>  [61] 0.63706378 0.64113267 0.64587687 0.65557031 0.66353883 0.67857040
#>  [67] 0.67894780 0.67900398 0.68540118 0.68997125 0.70839258 0.71331503
#>  [73] 0.72276400 0.72858580 0.73723089 0.74133266 0.75447392 0.75755684
#>  [79] 0.77472853 0.77633218 0.79123114 0.79177056 0.80336292 0.80557557
#>  [85] 0.82249343 0.85262363 0.85762856 0.85966664 0.86056332 0.86132739
#>  [91] 0.87836321 0.88079182 0.89097189 0.89265757 0.89337973 0.92575229
#>  [97] 0.93632982 0.97254803 0.97669580 0.99818761 1.00000000
#> 
#> 
#> $Kperc
#> $Kperc$x
#>   [1] 0.0004653491 0.0004653491 0.0279925719 0.0495384356 0.0581917963
#>   [6] 0.0704889777 0.0825027458 0.0869401679 0.0939166071 0.0994458233
#>  [11] 0.1081785294 0.1157796648 0.1247420886 0.1277056879 0.1370674714
#>  [16] 0.1470841086 0.1549117258 0.1604750925 0.1611657627 0.1652980812
#>  [21] 0.1655209111 0.1920233187 0.2151664882 0.2151720827 0.2172435140
#>  [26] 0.2300969204 0.2348196758 0.2366197421 0.2405307016 0.2530989940
#>  [31] 0.2707780194 0.2760496726 0.2828523996 0.2829928708 0.3029049153
#>  [36] 0.3077638743 0.3169492481 0.3217255378 0.3219373757 0.3295474134
#>  [41] 0.3393125802 0.3498017928 0.3580569634 0.3882046638 0.3954488591
#>  [46] 0.4274282807 0.4289485959 0.4361299961 0.4445273969 0.4498024841
#>  [51] 0.4597851932 0.4640166268 0.4784563838 0.4870325699 0.4979489362
#>  [56] 0.5238226017 0.5474594680 0.5636446835 0.5763018376 0.5838723360
#>  [61] 0.5849365573 0.5962635446 0.6126719653 0.6262569474 0.6271461844
#>  [66] 0.6442402205 0.6623855066 0.6733324814 0.6782238574 0.6807875512
#>  [71] 0.6863249468 0.6877426857 0.6912078315 0.7015851184 0.7048722457
#>  [76] 0.7065019011 0.7085741372 0.7317076589 0.7475163222 0.7558872597
#>  [81] 0.7603995362 0.7869273527 0.8103980662 0.8118274161 0.8139337213
#>  [86] 0.8220300712 0.8315685980 0.8344009779 0.8625518975 0.8664677632
#>  [91] 0.8900779132 0.8911143125 0.9053095817 0.9326810790 0.9506212641
#>  [96] 0.9531012138 0.9714380668 0.9747258085 0.9860542973 0.9929440161
#> [101] 0.9966172187
#> 
#> $Kperc$ecdf
#>   [1] 0.000000000 0.004429865 0.006467949 0.008137403 0.027473135 0.029353415
#>   [7] 0.040843521 0.046549286 0.084665199 0.084721370 0.089291442 0.106327262
#>  [13] 0.123245124 0.132481037 0.141820542 0.142232197 0.142663589 0.143268178
#>  [19] 0.153845714 0.168399958 0.190405782 0.201998136 0.206067024 0.210989482
#>  [25] 0.217707847 0.234187486 0.239072602 0.248766043 0.254689523 0.258456143
#>  [31] 0.260059791 0.265378998 0.274454065 0.281128117 0.282940509 0.320877306
#>  [37] 0.358281986 0.369395149 0.387816473 0.396461565 0.398967461 0.400653146
#>  [43] 0.424408217 0.430179679 0.445211249 0.446107923 0.446115900 0.448719430
#>  [49] 0.458899498 0.465132444 0.474581415 0.475345493 0.482956658 0.483334064
#>  [55] 0.483629571 0.496906816 0.501911742 0.525527840 0.531349634 0.537268107
#>  [61] 0.545264025 0.552654401 0.555838934 0.569013513 0.572096431 0.578756549
#>  [67] 0.596846749 0.604815264 0.610691653 0.636046822 0.652094570 0.665235831
#>  [73] 0.690539605 0.691079024 0.691801187 0.701623666 0.718759350 0.740415281
#>  [79] 0.744100947 0.755678935 0.791897147 0.813388958 0.820474057 0.826871261
#>  [85] 0.830973026 0.833212659 0.837121373 0.852312888 0.854741493 0.855793528
#>  [91] 0.859941291 0.866101578 0.883273269 0.887606418 0.917736621 0.922480826
#>  [97] 0.954853378 0.961813362 0.976712331 0.997787353 1.000000000
#> 
#> 
#> $Smax
#> $Smax$x
#>   [1] 0.01616048 0.01616048 0.01836408 0.02552670 0.03197163 0.03736996
#>   [7] 0.03949920 0.04770998 0.06078222 0.06265000 0.07997291 0.08146656
#>  [13] 0.08253118 0.08836330 0.09164469 0.12023713 0.15133817 0.17174341
#>  [19] 0.17801381 0.20108062 0.20493870 0.27454536 0.27685507 0.28181167
#>  [25] 0.28710013 0.30114252 0.30288762 0.31211279 0.32759740 0.33749500
#>  [31] 0.34132128 0.34871949 0.35360608 0.36467103 0.36545427 0.36644144
#>  [37] 0.36789595 0.38517360 0.39525376 0.39566064 0.41330541 0.42346365
#>  [43] 0.44703699 0.45476163 0.46471377 0.49006345 0.50394871 0.50837063
#>  [49] 0.50984290 0.51880492 0.52659008 0.52971409 0.52989246 0.53554139
#>  [55] 0.53605372 0.54702342 0.55331399 0.56673408 0.56938266 0.58273974
#>  [61] 0.58695866 0.58746137 0.65026150 0.65376668 0.66573514 0.66670516
#>  [67] 0.67901342 0.68760758 0.70903790 0.73589935 0.73903169 0.75311010
#>  [73] 0.76928554 0.77020476 0.80094821 0.80223822 0.81230483 0.81285269
#>  [79] 0.81508150 0.81647814 0.82925082 0.83210777 0.85409998 0.85436475
#>  [85] 0.86010685 0.87394991 0.87867402 0.88076411 0.88513265 0.88805519
#>  [91] 0.89433463 0.90323356 0.90604811 0.92935068 0.93913840 0.94503510
#>  [97] 0.94958532 0.96415257 0.96903886 0.97738358 0.98907827
#> 
#> $Smax$ecdf
#>   [1] 0.00000000 0.01691786 0.02134773 0.02711919 0.04861100 0.06703232
#>   [7] 0.07191744 0.07887742 0.08075770 0.08836887 0.09419066 0.13040888
#>  [13] 0.13431759 0.14002335 0.14594183 0.14648125 0.16351707 0.17510942
#>  [19] 0.18134237 0.19589661 0.19758230 0.20815983 0.23016566 0.23940157
#>  [25] 0.25657326 0.26157818 0.26400679 0.27139717 0.28467441 0.28634386
#>  [31] 0.31169903 0.31626911 0.33116808 0.33782819 0.35285976 0.36219927
#>  [37] 0.37534053 0.38330904 0.39978868 0.40008419 0.40316711 0.41474510
#>  [43] 0.42339019 0.45352039 0.49092507 0.49164724 0.50313734 0.50690396
#>  [49] 0.50733535 0.51349564 0.54586819 0.55556163 0.55924730 0.55930347
#>  [55] 0.56912595 0.57820101 0.61631693 0.62303529 0.62895877 0.64415029
#>  [61] 0.64829805 0.64919472 0.65719064 0.65879429 0.66519149 0.67106788
#>  [67] 0.68424246 0.70785856 0.71803863 0.72335784 0.72654237 0.72759440
#>  [73] 0.72835848 0.73947164 0.74614570 0.76990077 0.79520454 0.79930631
#>  [79] 0.80134439 0.80355704 0.80393444 0.82559037 0.86352717 0.86393883
#>  [85] 0.86886128 0.87319443 0.87726332 0.89833834 0.90542344 0.92475918
#>  [91] 0.94080692 0.94261932 0.94485895 0.94746248 0.95220668 0.95471258
#>  [97] 0.97280278 0.98993846 0.99938743 0.99939541 1.00000000
#> 
#> 

# Example 3: Retaining only behavioural parameter sets above a threshold
gofs <- runif(100, min=0.4, max=0.95)
params2ecdf(params, gofs=gofs, MinMax="max", beh.thr=0.75,
            plot=TRUE, main="Parameter ECDFs for behavioural simulations")
#> [ Number of behavioural parameter sets: 35 ]
#> [ Computing the ECDF for 'Kq   ' , 1/6 => 16.67% ]
#> [ Computing the ECDF for 'Ks   ' , 2/6 => 33.33% ]
#> [ Computing the ECDF for 'Alpha' , 3/6 => 50.00% ]
#> [ Computing the ECDF for 'Beta ' , 4/6 => 66.67% ]
#> [ Computing the ECDF for 'Kperc' , 5/6 => 83.33% ]
#> [ Computing the ECDF for 'Smax ' , 6/6 => 100.00% ]

#> $Kq
#> $Kq$x
#>  [1] 0.04205953 0.04205953 0.09359499 0.10292468 0.11113542 0.14280002
#>  [7] 0.14711365 0.20653139 0.22011889 0.24361947 0.24608773 0.32792072
#> [13] 0.34351647 0.37446278 0.41764678 0.43983169 0.44220007 0.46677904
#> [19] 0.47779597 0.51150546 0.56094798 0.59414202 0.61277100 0.66511519
#> [25] 0.70853047 0.75330786 0.75447516 0.75845954 0.78819583 0.81006435
#> [31] 0.88301740 0.89305111 0.89982497 0.95450365 0.96302423 0.98495698
#> 
#> $Kq$ecdf
#>                    0.0420595335308462 0.0935949867125601  0.102924682665616 
#>         0.00000000         0.02857143         0.05714286         0.08571429 
#>  0.111135424347594  0.142800022382289  0.147113647311926   0.20653138961643 
#>         0.11428571         0.14285714         0.17142857         0.20000000 
#>  0.220118885161355  0.243619472719729   0.24608773435466  0.327920719282702 
#>         0.22857143         0.25714286         0.28571429         0.31428571 
#>  0.343516472261399  0.374462775886059  0.417646779678762  0.439831687603146 
#>         0.34285714         0.37142857         0.40000000         0.42857143 
#>  0.442200074205175   0.46677904156968  0.477795971091837  0.511505459900945 
#>         0.45714286         0.48571429         0.51428571         0.54285714 
#>  0.560947983758524   0.59414202044718  0.612771003274247  0.665115194628015 
#>         0.57142857         0.60000000         0.62857143         0.65714286 
#>  0.708530468167737  0.753307864302769  0.754475158639252  0.758459537522867 
#>         0.68571429         0.71428571         0.74285714         0.77142857 
#>  0.788195834029466  0.810064353048801  0.883017404004931  0.893051114398986 
#>         0.80000000         0.82857143         0.85714286         0.88571429 
#>  0.899824970401824  0.954503649147227  0.963024232536554  0.984956979984418 
#>         0.91428571         0.94285714         0.97142857         1.00000000 
#> 
#> 
#> $Ks
#> $Ks$x
#>  [1] 0.0910440 0.0910440 0.1110965 0.1422943 0.1523466 0.2168928 0.2179907
#>  [8] 0.2650178 0.2650327 0.2656867 0.3117022 0.3899944 0.4045103 0.4975273
#> [15] 0.5022996 0.5298357 0.5492847 0.5645904 0.5728671 0.5817501 0.5854834
#> [22] 0.6180179 0.6192565 0.6299731 0.6592303 0.6598384 0.6900071 0.7082903
#> [29] 0.7205963 0.7403344 0.8218055 0.8397678 0.9540912 0.9544738 0.9842192
#> [36] 0.9856409
#> 
#> $Ks$ecdf
#>                    0.0910439998842776  0.111096461303532  0.142294295597821 
#>         0.00000000         0.02857143         0.05714286         0.08571429 
#>  0.152346616843715  0.216892762808129   0.21799066872336  0.265017806086689 
#>         0.11428571         0.14285714         0.17142857         0.20000000 
#>   0.26503273146227  0.265686686849222   0.31170220207423  0.389994435245171 
#>         0.22857143         0.25714286         0.28571429         0.31428571 
#>  0.404510281747207  0.497527267085388  0.502299563260749  0.529835685854778 
#>         0.34285714         0.37142857         0.40000000         0.42857143 
#>  0.549284656066447  0.564590434776619  0.572867058217525  0.581750099780038 
#>         0.45714286         0.48571429         0.51428571         0.54285714 
#>  0.585483353119344  0.618017873261124  0.619256483390927  0.629973053466529 
#>         0.57142857         0.60000000         0.62857143         0.65714286 
#>  0.659230324206874   0.65983844967559  0.690007101511583   0.70829032221809 
#>         0.68571429         0.71428571         0.74285714         0.77142857 
#>  0.720596273429692  0.740334360394627  0.821805460145697  0.839767764788121 
#>         0.80000000         0.82857143         0.85714286         0.88571429 
#>   0.95409123855643  0.954473827499896  0.984219203470275  0.985640884377062 
#>         0.91428571         0.94285714         0.97142857         1.00000000 
#> 
#> 
#> $Alpha
#> $Alpha$x
#>  [1] 0.04766363 0.04766363 0.06492830 0.07190410 0.09904183 0.10359964
#>  [7] 0.19774474 0.22178793 0.22498533 0.22588643 0.33633121 0.35188864
#> [13] 0.39522013 0.39658459 0.39715195 0.40439918 0.40894400 0.46647238
#> [19] 0.50281305 0.51502973 0.53107040 0.54682616 0.56025326 0.61835123
#> [25] 0.64881812 0.70085309 0.73518431 0.75859317 0.78529167 0.79883161
#> [31] 0.82095132 0.86810681 0.87104341 0.91568354 0.91885735 0.92570796
#> 
#> $Alpha$ecdf
#>                    0.0476636274252087 0.0649282999802381 0.0719040972180665 
#>         0.00000000         0.02857143         0.05714286         0.08571429 
#> 0.0990418293513358  0.103599644964561  0.197744736680761  0.221787934657186 
#>         0.11428571         0.14285714         0.17142857         0.20000000 
#>  0.224985329201445  0.225886432919651  0.336331205908209  0.351888638455421 
#>         0.22857143         0.25714286         0.28571429         0.31428571 
#>  0.395220134640113  0.396584594622254  0.397151953307912  0.404399181017652 
#>         0.34285714         0.37142857         0.40000000         0.42857143 
#>  0.408943997928873  0.466472376836464  0.502813045633957  0.515029727248475 
#>         0.45714286         0.48571429         0.51428571         0.54285714 
#>  0.531070398865268  0.546826156554744   0.56025326368399  0.618351227371022 
#>         0.57142857         0.60000000         0.62857143         0.65714286 
#>  0.648818124318495  0.700853087473661  0.735184305813164  0.758593169506639 
#>         0.68571429         0.71428571         0.74285714         0.77142857 
#>  0.785291671287268  0.798831611173227  0.820951323956251  0.868106806883588 
#>         0.80000000         0.82857143         0.85714286         0.88571429 
#>  0.871043413644657  0.915683538420126  0.918857348151505    0.9257079558447 
#>         0.91428571         0.94285714         0.97142857         1.00000000 
#> 
#> 
#> $Beta
#> $Beta$x
#>  [1] 0.03372777 0.03372777 0.03487480 0.10105849 0.11791384 0.14381704
#>  [7] 0.18529644 0.19337868 0.20887635 0.23774940 0.28221842 0.35398610
#> [13] 0.35478310 0.37270939 0.41473533 0.41891590 0.42184495 0.48316767
#> [19] 0.49256655 0.58490009 0.61723527 0.62190230 0.69737377 0.72598303
#> [25] 0.72939065 0.76919391 0.80281227 0.83525532 0.83570884 0.85688542
#> [31] 0.91506376 0.96384333 0.96746949 0.97134245 0.98595417 0.99123656
#> 
#> $Beta$ecdf
#>                    0.0337277729995549 0.0348748040851206   0.10105849406682 
#>         0.00000000         0.02857143         0.05714286         0.08571429 
#>   0.11791384126991  0.143817043630406  0.185296441894025  0.193378679919988 
#>         0.11428571         0.14285714         0.17142857         0.20000000 
#>  0.208876348566264  0.237749404972419  0.282218417385593  0.353986102622002 
#>         0.22857143         0.25714286         0.28571429         0.31428571 
#>  0.354783097514883  0.372709394432604  0.414735334459692  0.418915896909311 
#>         0.34285714         0.37142857         0.40000000         0.42857143 
#>  0.421844950178638  0.483167669270188  0.492566547822207  0.584900093497708 
#>         0.45714286         0.48571429         0.51428571         0.54285714 
#>  0.617235269630328  0.621902295155451  0.697373766219243  0.725983026903123 
#>         0.57142857         0.60000000         0.62857143         0.65714286 
#>  0.729390651918948  0.769193911226466  0.802812272915617  0.835255319951102 
#>         0.68571429         0.71428571         0.74285714         0.77142857 
#>  0.835708837024868  0.856885420158505   0.91506376164034  0.963843331905082 
#>         0.80000000         0.82857143         0.85714286         0.88571429 
#>  0.967469494324178  0.971342450240627  0.985954165225849  0.991236555855721 
#>         0.91428571         0.94285714         0.97142857         1.00000000 
#> 
#> 
#> $Kperc
#> $Kperc$x
#>  [1] 0.0004653491 0.0004653491 0.0279925719 0.0495384356 0.0939166071
#>  [6] 0.1081785294 0.1247420886 0.1277056879 0.1920233187 0.2151664882
#> [11] 0.2300969204 0.2366197421 0.2760496726 0.2829928708 0.3077638743
#> [16] 0.3217255378 0.3498017928 0.3882046638 0.4445273969 0.4597851932
#> [21] 0.4784563838 0.5763018376 0.6126719653 0.6262569474 0.6782238574
#> [26] 0.6863249468 0.6877426857 0.7048722457 0.7475163222 0.7869273527
#> [31] 0.8103980662 0.8625518975 0.8900779132 0.9506212641 0.9531012138
#> [36] 0.9747258085
#> 
#> $Kperc$ecdf
#>                      0.000465349061414599   0.0279925719369203 
#>           0.00000000           0.02857143           0.05714286 
#>   0.0495384356472641   0.0939166070893407     0.10817852942273 
#>           0.08571429           0.11428571           0.14285714 
#>    0.124742088606581    0.127705687889829    0.192023318726569 
#>           0.17142857           0.20000000           0.22857143 
#>    0.215166488196701    0.230096920393407    0.236619742121547 
#>           0.25714286           0.28571429           0.31428571 
#>    0.276049672625959    0.282992870779708    0.307763874297962 
#>           0.34285714           0.37142857           0.40000000 
#>    0.321725537767634    0.349801792763174    0.388204663759097 
#>           0.42857143           0.45714286           0.48571429 
#>    0.444527396932244     0.45978519320488    0.478456383803859 
#>           0.51428571           0.54285714           0.57142857 
#>    0.576301837572828    0.612671965267509    0.626256947405636 
#>           0.60000000           0.62857143           0.65714286 
#>    0.678223857423291    0.686324946815148    0.687742685666308 
#>           0.68571429           0.71428571           0.74285714 
#>    0.704872245667502    0.747516322182491    0.786927352659404 
#>           0.77142857           0.80000000           0.82857143 
#>    0.810398066183552    0.862551897531375    0.890077913179994 
#>           0.85714286           0.88571429           0.91428571 
#>    0.950621264055371    0.953101213788614    0.974725808482617 
#>           0.94285714           0.97142857           1.00000000 
#> 
#> 
#> $Smax
#> $Smax$x
#>  [1] 0.01616048 0.01616048 0.01836408 0.02552670 0.03197163 0.04770998
#>  [7] 0.06265000 0.07997291 0.17174341 0.20493870 0.28181167 0.30288762
#> [13] 0.33749500 0.34871949 0.36789595 0.39525376 0.45476163 0.49006345
#> [19] 0.52971409 0.52989246 0.55331399 0.58695866 0.66670516 0.67901342
#> [25] 0.70903790 0.73589935 0.73903169 0.77020476 0.80094821 0.81508150
#> [31] 0.85409998 0.87867402 0.88513265 0.89433463 0.93913840 0.96903886
#> 
#> $Smax$ecdf
#>                    0.0161604809109122 0.0183640837203711 0.0255266984459013 
#>         0.00000000         0.02857143         0.05714286         0.08571429 
#> 0.0319716280791909 0.0477099849376827 0.0626499983482063 0.0799729123245925 
#>         0.11428571         0.14285714         0.17142857         0.20000000 
#>  0.171743405982852  0.204938702983782   0.28181166970171  0.302887624595314 
#>         0.22857143         0.25714286         0.28571429         0.31428571 
#>  0.337494997307658  0.348719493718818  0.367895947769284  0.395253761438653 
#>         0.34285714         0.37142857         0.40000000         0.42857143 
#>  0.454761631321162  0.490063453093171  0.529714091448113  0.529892458580434 
#>         0.45714286         0.48571429         0.51428571         0.54285714 
#>  0.553313987562433   0.58695865678601  0.666705157840624  0.679013415705413 
#>         0.57142857         0.60000000         0.62857143         0.65714286 
#>  0.709037903463468  0.735899350373074  0.739031685516238  0.770204759435728 
#>         0.68571429         0.71428571         0.74285714         0.77142857 
#>  0.800948211923242  0.815081495093182  0.854099977528676   0.87867402122356 
#>         0.80000000         0.82857143         0.85714286         0.88571429 
#>  0.885132651543245  0.894334625452757  0.939138400601223  0.969038863666356 
#>         0.91428571         0.94285714         0.97142857         1.00000000 
#> 
#> 
# }