plot_NparOF: N 2-dimensional plots of Parameter Values against the...

View source: R/plot_NparOF.R

plot_NparOFR Documentation

N 2-dimensional plots of Parameter Values against the Objective Function

Description

For n user-defined parameters, the function creates sum(1:(npar-1)) plot_2parOF plots, with the values of the objective function in a 2D box, where the boundaries of each parameter are used as axis
The sum(1:(npar-1)) plots corresponds to all the possible combinations of 2 parameters among all the n parameters provided

Usage

plot_NparOF(params, gofs, param.names=colnames(params), 
         MinMax=c(NULL,"min","max"), beh.thr=NA, nrows="auto", 
         gof.name="GoF", main=paste(gof.name, "Surface"), GOFcuts="auto", 
         colorRamp= colorRampPalette(c("darkred", "red", "orange", "yellow", 
         "green", "darkgreen", "cyan")), points.cex=0.7, alpha=0.65, 
         axis.rot=c(0, 0), verbose=TRUE)

Arguments

params

matrix or data.frame with the parameter values

gofs

numeric with the values of goodness-of-fit values for each one of the parameters in params (in the same order!)

param.names

character, names for the parameters in params that have to be plotted (param.names can be a subset of params)

MinMax

character, indicates whether the optimum value in gofs corresponds to the minimum or maximum of the objective function.
It is required when beh.thr is provided. Valid values are in: c(NULL, 'min', 'max')
By default, MinMax=NULL which plot particles in the order they are provided in params and gofs in each one of the output figures
If MinMax='min' place particles with lower goodness-of-fit values are plotted on top of those with larger values, in each one of the output figures, and vice-versa for MinMax='max'.

beh.thr

OPTIONAL
numeric, threshold value used for selecting parameter sets that have to be used in the analysis (‘behavioural parameters’, using the GLUE terminology)
If MinMax='min', only parameter sets with a goodness-of-fit value (given by gofs) less than or equal to beh.thr will be considered for the subsequent analysis.
If MinMax='max', only parameter sets with a goodness-of-fit value (given by gofs) greater than or equal to beh.thr will be considered for the subsequent analysis

nrows

numeric, number of rows to be used in the plotting window
If nrows='auto' the number of columns is automatically computed depending on the number of parameters in params

gof.name

character, name of the objective function to be plotted. It has to correspond to the name of one column of params
It is used as title for the legend of the final figure.

main

character, currently not used

GOFcuts

numeric, specifies at which values of the objective function given in gofs the colours of the plot have to change
If GOFcuts="auto" and MinMax=NULL, the intervals are defined by the (unique values of the) gofs quantiles corresponding to the following probabilities: probs=c(0, 0.1, 0.25, 0.5, 0.75, 0.9, 1)
If GOFcuts="auto" and MinMax='min', the intervals are defined by the (unique values of the) gofs quantiles corresponding to the following probabilities: probs=c(0, 0.25, 0.5, 0.85, 0.9, 0.97, 1)
If GOFcuts="auto" and MinMax='max', the intervals are defined by the (unique values of the) gofs quantiles corresponding to the following probabilities: probs=c(0, 0.03, 0.1, 0.15, 0.5, 0.75, 1)

colorRamp

R function defining the colour ramp to be used for colouring the pseudo-3D dotty plots of Parameter Values, OR character representing those colours

points.cex

size of the points to be plotted

alpha

numeric between 0 and 1 representing the transparency level to apply to colorRamp, ‘0’ means fully transparent and ‘1’ means opaque

axis.rot

numeric vector of length 2 representing the angle (in degrees) by which the axis labels are to be rotated, left/bottom and right/top, respectively.

verbose

logical; if TRUE, progress messages are printed

Author(s)

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

See Also

plot_2parOF, read_results, plot_results, plot_GofPerParticle, plot_params, plot_ParamsPerIter

Examples

# Number of dimensions to be optimised
D <- 5

# Boundaries of the search space (Rosenbrock test function)
lower <- rep(-30, D)
upper <- rep(30, D)

## Not run: 
# Setting the user's home directory as working directory
setwd("~")

# Setting the seed
set.seed(100)

# Optimising the 'Rosenbrock' test function, and writing the results to text files
hydroPSO(fn=rosenbrock, lower=lower, upper=upper, control=list(write2disk=TRUE) ) 
  
# reading the 'Particles.txt' output file of hydroPSO
setwd("PSO.out")
particles <- read_particles(plot=FALSE)
               
# plotting the value of each parameter and the objective function against the 
# values of the objective function
plot_NparOF(params=particles[["part.params"]], gofs=particles[["part.gofs"]],
            gof.name="Rosenbrock", alpha=0.5)

## End(Not run)

hzambran/hydroPSO documentation built on Feb. 3, 2024, 4:39 p.m.