plot.validann {validann} | R Documentation |
Plot ANN validation results.
Description
Plot method for objects of class ‘validann’. Produces a series
of plots used for validating and assessing ANN models based on results
returned by validann
.
Usage
## S3 method for class 'validann'
plot(x, obs, sim, gof = TRUE, resid = TRUE, sa = TRUE,
display = c("multi", "single"), profile = c("all", "median"), ...)
Arguments
x |
object of class ‘validann’ as returned
by |
obs , sim |
vectors comprising observed ( |
gof |
logical; should goodness-of-fit plots be produced? Default = TRUE. |
resid |
logical; should residual analysis plots be produced? Default = TRUE. |
sa |
logical; should input sensitivity analysis plots be produced? Default = TRUE. |
display |
character string defining how plots should be
displayed. The default is “multi” where multiple plots are displayed
together according to whether they are goodness-of-fit, residual analysis
or sensitivity analysis plots. For “single”, each plot is displayed on
its own. If the session is interactive, the user will be asked to confirm
a new page whether |
profile |
character string defining which structural validity Profile method outputs should be plotted. The default is “all” where outputs corresponding to 5 summary statistics are plotted together with the median predicted response for each input value. For “median”, only the median response is plotted. |
... |
Arguments to be passed to plot (not currently used). |
Details
This function can be invoked by calling
plot(x, obs, sim)
for an object x
of class
‘validann’.
To produce plots for all types of validation metrics and statistics,
gof
, resid
and sa
must be
TRUE
and corresponding results must have been successfully
computed by validann
and returned in object x
.
If gof
is TRUE
, a scatter plot, Q-Q plot and
time/sample plot of observed (obs
) versus predicted (sim
)
data are produced.
If resid
is TRUE
and x$residuals
is not NULL
, plots of the model residuals are produced including
histogram, Q-Q plot (standardized residuals compared to standard normal),
autocorrelation (acf), partial autocorrelation (pacf), standardized
residual versus predicted output (i.e. sim
) and standardized
residual versus time/order of the data.
If sa
is TRUE
and x$y_hat
is not
NULL
, model response values resulting from the Profile
sensitivity analysis are plotted against percentiles of each
input. If x$rs
is not NULL
, the relative sensitivities of
each input, as computed by the partial derivative (PaD) sensitivity
analysis, are plotted against predicted output.
Setting gof
, resid
and/or sa
to FALSE
will ‘turn off’ the respective validation plots.
See Also
Examples
## Build ANN model and compute replicative and structural validation results
data("ar9")
samp <- sample(1:1000, 200)
y <- ar9[samp, ncol(ar9)]
x <- ar9[samp, -ncol(ar9)]
x <- x[, c(1,4,9)]
fit <- ann(x, y, size = 1, act_hid = "tanh", act_out = "linear", rang = 0.1)
results <- validann(fit, x = x)
obs <- observed(fit)
sim <- fitted(fit)
## Plot replicative and structural validation results to the current device
## - a single page for each type of validation
plot(results, obs, sim)
## Plot results to the current device - a single page for each plot
plot(results, obs, sim, display = "single")
## Plot replicative and structural validation results to single file
pdf("RepStructValidationPlots.pdf")
plot(results, obs, sim)
dev.off()
## Get predictive validation results for above model based on a new sample
## of ar9 data.
samp <- sample(1:1000, 200)
y <- ar9[samp, ncol(ar9)]
x <- ar9[samp, -ncol(ar9)]
x <- x[, c(1,4,9)]
obs <- y
sim <- predict(fit, newdata = x)
results <- validann(fit, obs = obs, sim = sim, x = x)
## Plot predictive results only to file
pdf("PredValidationPlots.pdf")
plot(results, obs, sim, resid = FALSE, sa = FALSE)
dev.off()