diff --git a/DESCRIPTION b/DESCRIPTION index 85ae92d43d3ea77ba6541300778e5170458ac2ce..2837494004c6ca03130503b7780681b6f0175837 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: hydroPSO Type: Package Title: Model-Independent Particle Swarm Optimisation for Environmental Models -Version: 0.1-58-24 -Date: 2012-11-15 +Version: 0.1-58-25 +Date: 2012-11-19 Authors@R: c(person("Mauricio", "Zambrano-Bigiarini", email="mzb.devel@gmail.com", role=c("aut","cre")), person("Rodrigo", "Rojas", email="Rodrigo.RojasMujica@gmail.com", role=c("ctb")) ) Maintainer: Mauricio Zambrano-Bigiarini <mzb.devel@gmail.com> Description: This package implements a state-of-the-art version of the Particle Swarm Optimisation (PSO) algorithm (SPSO-2011 and SPSO-2007 capable), with a special focus on the calibration of environmental models. hydroPSO is model-independent, allowing the user to easily interface any model code with the calibration engine (PSO). It includes a series of controlling options and PSO variants to fine-tune the performance of the calibration engine to different calibration problems. An advanced sensitivity analysis function together with user-friendly plotting summaries facilitate the interpretation and assessment of the calibration results. Bugs reports/comments/questions are very welcomed. diff --git a/R/params2ecdf.R b/R/params2ecdf.R index 4a3594b10ac8877535d7060d1f720f1805a8881a..9693d8733d02d0345902617e658cfc5751d55216 100755 --- a/R/params2ecdf.R +++ b/R/params2ecdf.R @@ -32,15 +32,13 @@ params2ecdf <- function(params, ...) UseMethod("params2ecdf") ################################################################################ # Author : Mauricio Zambrano-Bigiarini # # Started: 12-Oct-2011 # -# Updates: 15-Feb-2012 ; 21-Feb-2012 # +# Updates: 15-Feb-2012 ; 21-Feb-2012 ; 19-Nov-2012 # ################################################################################ params2ecdf.default <- function(params, param.names=NULL, - - gofs, + gofs=NULL, MinMax=NULL, beh.thr=NA, - weights=NULL, byrow=FALSE, plot=TRUE, @@ -80,7 +78,7 @@ params2ecdf.default <- function(params, if ( !is.na(beh.thr) ) { if ( is.null(MinMax) ) stop("Missing argument: 'MinMax' has to be provided before using 'beh.thr' !!") - if ( missing(gofs) ) { + if ( is.null(gofs) ) { stop("Missing argument: 'gofs' has to be provided before using 'beh.thr' !!") } else if (length(gofs) != n) stop("Invalid argument: 'length(gofs) != nrow(params)' (", length(gofs), "!=", n, ") !!" ) @@ -283,13 +281,16 @@ params2ecdf.default <- function(params, } # END 'params2ecdf.default' -################################################################################ # +################################################################################ # Author : Mauricio Zambrano-Bigiarini # # Started: 12-Oct-2011 # -# Updates: 12-Oct-2011 # +# Updates: 12-Oct-2011 ; 19-Nov-2012 # ################################################################################ params2ecdf.matrix <- function(params, param.names=colnames(params), + gofs=NULL, + MinMax=NULL, + beh.thr=NA, weights=NULL, byrow=FALSE, plot=TRUE, @@ -314,6 +315,9 @@ params2ecdf.matrix <- function(params, ) { params2ecdf.default(params=params, param.names=param.names, + gofs=gofs, + MinMax=MinMax, + beh.thr=beh.thr, weights=weights, byrow=byrow, plot=plot, @@ -338,13 +342,16 @@ params2ecdf.matrix <- function(params, ) } # END 'params2ecdf.data.frame' -################################################################################ # +################################################################################ # Author : Mauricio Zambrano-Bigiarini # # Started: 12-Oct-2011 # -# Updates: 12-Oct-2011 # +# Updates: 12-Oct-2011 ; 19-Nov-2012 # ################################################################################ params2ecdf.data.frame <- function(params, param.names=colnames(params), + gofs=NULL, + MinMax=NULL, + beh.thr=NA, weights=NULL, byrow=FALSE, plot=TRUE, @@ -371,6 +378,9 @@ params2ecdf.data.frame <- function(params, params2ecdf.default(params=params, param.names=param.names, + gofs=gofs, + MinMax=MinMax, + beh.thr=beh.thr, weights=weights, byrow=byrow, plot=plot, diff --git a/man/ReadPlot_particles.Rd b/man/ReadPlot_particles.Rd index 62fc1e6d9291a3181679aa1efbdd68e30b6b464a..dcd4b1392c81601c9780a1804b1705902fac5a1f 100755 --- a/man/ReadPlot_particles.Rd +++ b/man/ReadPlot_particles.Rd @@ -91,8 +91,8 @@ OPTIONAL. character, indicates if the optimum value in \code{params} corresponds Valid values are in: \code{c('min', 'max')} } \item{beh.thr}{ -numeric, used for selecting only the behavioural parameter sets, i.e., those with a goodness-of-fit value larger/lowervalue than \code{beh.th}, depending on the value of \code{MinMax}. \cr -It is only used for drawing a horizontal line used for separating behavioural from non behavioural parameter sets. +numeric, used for selecting only the behavioural parameter sets, i.e. those with a goodness-of-fit value greater/less than or equal to \code{beh.thr}, depending on the value of \code{MinMax}\cr +By default \code{beh.thr=NA} and all the parameter sets are considered for the subsequent anlysis } \item{beh.col}{ OPTIONAL. Only used when \code{plot=TRUE} \cr diff --git a/man/params2ecdf.Rd b/man/params2ecdf.Rd index 9af8b0e4211fe214a3f772e99b2ad41c8951643a..73510c65b3756daedfdc419e0576155c3724864f 100755 --- a/man/params2ecdf.Rd +++ b/man/params2ecdf.Rd @@ -20,26 +20,26 @@ This function computes (weighted) empirical CDFs (ECDFs) for each calibrated par \usage{ params2ecdf(params, ...) -\method{params2ecdf}{default}(params, param.names=NULL, 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") +\method{params2ecdf}{default}(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") -\method{params2ecdf}{matrix}(params, param.names=colnames(params), weights, - 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") +\method{params2ecdf}{matrix}(params, param.names=colnames(params), gofs=NULL, + MinMax=NULL, beh.thr=NA, weights, 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") -\method{params2ecdf}{data.frame}(params, param.names=colnames(params), weights, - 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") +\method{params2ecdf}{data.frame}(params, param.names=colnames(params), gofs=NULL, + MinMax=NULL, beh.thr=NA, weights, 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") } %- maybe also 'usage' for other objects documented here. \arguments{ @@ -48,6 +48,17 @@ matrix or data.frame with the parameter values, where each row represent a diffe } \item{param.names}{ character vector, names to be used for each parameter in \code{params} (by default its column names) +} + \item{gofs}{ +OPTIONAL. numeric with the values of goodness-of-fit values for each parameter in \code{params} (in the same order!) +} + \item{MinMax}{ +OPTIONAL. character, indicates if the optimum value in \code{params} corresponds to the minimum or maximum of the the objective function. Only used to identify the optimum in the plot \cr +Valid values are in: \code{c('min', 'max')} +} + \item{beh.thr}{ +numeric, used for selecting only the behavioural parameter sets, i.e. those with a goodness-of-fit value (as given in \code{gofs}) greater/less than or equal to \code{beh.thr}, depending on the value of \code{MinMax}\cr +By default \code{beh.thr=NA} and all the parameter sets are considered for the subsequent anlysis } \item{weights}{ numeric vector, values of the weights to be used for computing the empirical CDFs \cr