
Last chance! 50% off unlimited learning
Sale ends in
validann
.# S3 method for validann
plot(x, obs, sim, gof = TRUE, resid = TRUE, sa = TRUE,
display = c("multi", "single"), profile = c("all", "median"), ...)
validann
. This is a list comprising metrics and
statistics that can be used for validating ANN models.obs
) and simulated
(sim
) examples of a single response variable used for computing
x
object.display
is ``single'' or ``multi''.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.validann
## 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()
Run the code above in your browser using DataLab