ReadPlot_out | R Documentation |
This function reads the values of the objective function/model output for each particle and iteration with optional plot
read_out(file="Model_out.txt", modelout.cols=NULL, nsim=NULL, obs, MinMax=NULL,
beh.thr=NA,verbose=TRUE,plot=TRUE,ptype=c("corr","ts","ecdf","quant2ecdf"),
ftype="dm", FUN=mean, weights=NULL, byrow=TRUE,
quantiles.desired= c(0.05,0.5,0.95),
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, do.png=FALSE, png.width=1500,
png.height=900, png.res=90, png.fname="ModelOut_vs_Obs.png")
plot_out(sim, obs, dates=NULL, ptype=c("corr","ts","ecdf","quant2ecdf"),
MinMax=NULL, ftype="o", FUN=mean, verbose=TRUE, weights=NULL, byrow=TRUE,
quantiles.desired= c(0.05,0.5,0.95), 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,
do.png=FALSE, png.width=1500, png.height=900, png.res=90,
png.fname="ModelOut_vs_Obs.png")
file |
character, name (including path) of the output file with the values of the model / objective function for each particle and iteration |
modelout.cols |
numeric, column number in |
nsim |
OPTIONAL. number simulated equivalent values of the model / objective function to be compared against observations. |
sim |
numeric or zoo vector, simulated equivalent values of the model / objective function to be compared against observations |
obs |
OPTIONAL. numeric or zoo vector, observations to be compared against the best simulated value. If |
dates |
OPTIONAL. character or Date object used to assign time stamps to each element of |
MinMax |
OPTIONAL. character, indicates whether the optimum value corresponds to the minimum or maximum of the the objective function. It is used to filter out model outputs with a non-acceptable performance |
beh.thr |
OPTIONAL. numeric, used for selecting only the behavioural parameter sets, i.e. those with a goodness-of-fit value larger/lower than |
verbose |
logical, if TRUE, progress messages are printed |
plot |
logical, indicates if a plot with the convergence measures has to be produced |
ptype |
character, type of plot. Valid values are: |
ftype |
OPTIONAL. Only used when |
FUN |
OPTIONAL. Only used when |
weights |
numeric vector, values of the weights to be used for computing the quantiles. See |
byrow |
logical, indicates whether the computations have to be made for each column or for each row of |
quantiles.desired |
numeric vector, quantiles to be computed for model outputs. Default values are c(.025, .5, .975) ( => 2.5%, 50%, 97.5% ). See |
quantiles.labels |
OPTIONAL. Only used when |
main |
OPTIONAL. Only used when |
ylab |
OPTIONAL. Only used when |
col |
OPTIONAL. Only used when |
leg.cex |
OPTIONAL. Only used when |
leg.pos |
OPTIONAL. Only used when |
cex.axis |
OPTIONAL. Only used when |
cex.main |
OPTIONAL. Only used when |
cex.lab |
OPTIONAL. Only used when |
do.png |
logical, indicates if the plot with the comparison between model outputs and observations has to be saved into a PNG file instead of the screen device |
png.width |
OPTIONAL. Only used when |
png.height |
OPTIONAL. Only used when |
png.res |
OPTIONAL. Only used when |
png.fname |
OPTIONAL. Only used when |
list with three elements:
model.values |
matrix/data.frame (or numeric) with the values of the model / objective function for each particle and iteration |
model.gofs |
numeric vector with the goodness-of-fit value for each row (or value) in ‘model.values’ |
model.best |
numeric with the best model / objective function value. In order to be computed, the user has to provide a valid value for |
model.obs |
numeric with the observed values used during the optimisation. See |
Mauricio Zambrano-Bigiarini, mzb.devel@gmail.com
read_results
, plot_results
, quant2ecdf
## Not run:
# Setting the user home directory as working directory
setwd("~")
# Number of dimensions to be optimised
D <- 5
# Boundaries of the search space (Sphere test function)
lower <- rep(-100, D)
upper <- rep(100, D)
# Setting the seed
set.seed(100)
# Runing PSO with the 'Sphere' test function, writting the results to text files
hydroPSO(fn=sphere, lower=lower, upper=upper,
control=list(maxit=100, topology="gbest", write2disk=TRUE, plot=TRUE)
)
# Reading the convergence measures got by running hydroPSO
setwd("PSO.out")
read_out(MinMax="min") # each particle in a different pannel
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.