morris | R Documentation |
morris
implements the Morris's elementary effects screening
method (Morris, 1991). This method, based on design of experiments,
allows to identify the few important factors at a cost of r
\times (p+1)
simulations (where p
is the number
of factors). This implementation includes some improvements of the
original method: space-filling optimization of the design (Campolongo
et al. 2007) and simplex-based design (Pujol 2009).
morris(model = NULL, factors, r, design, binf = 0, bsup = 1,
scale = TRUE, ...)
## S3 method for class 'morris'
tell(x, y = NULL, ...)
## S3 method for class 'morris'
print(x, ...)
## S3 method for class 'morris'
plot(x, identify = FALSE, atpen = FALSE, y_col = NULL,
y_dim3 = NULL, ...)
## S3 method for class 'morris'
plot3d(x, alpha = c(0.2, 0), sphere.size = 1, y_col = NULL,
y_dim3 = NULL)
model |
a function, or a model with a |
factors |
an integer giving the number of factors, or a vector of character strings giving their names. |
r |
either an integer giving the number of repetitions of the design,
i.e. the number of elementary effect computed per factor, or a
vector of two integers |
design |
a list specifying the design type and its parameters:
|
binf |
either an integer, specifying the minimum value for the factors, or a vector for different values for each factor. |
bsup |
either an integer, specifying the maximum value for the factors, or a vector for different values for each factor. |
scale |
logical. If |
x |
a list of class |
y |
a vector of model responses. |
identify |
logical. If |
atpen |
logical. If |
y_col |
an integer defining the index of the column of |
y_dim3 |
an integer defining the index in the third dimension of
|
alpha |
a vector of three values between 0.0 (fully transparent) and 1.0
(opaque) (see |
sphere.size |
a numeric value, the scale factor for displaying the spheres. |
... |
for |
plot.morris
draws the (\mu^*,\sigma)
graph.
plot3d.morris
draws the (\mu, \mu^*,\sigma)
graph (requires the rgl package). On this graph, the
points are in a domain bounded by a cone and two planes (application
of the Cauchy-Schwarz inequality).
When using the space-filling improvement (Campolongo et al. 2007) of the Morris design, we recommend to install before the "pracma" R package: its "distmat"" function makes running the function with a large number of initial estimates (r2) significantly faster (by accelerating the inter-point distances calculations).
This version of morris
also supports matrices and three-dimensional
arrays as output of model
.
morris
returns a list of class "morris"
, containing all
the input argument detailed before, plus the following components:
call |
the matched call. |
X |
a |
y |
either a vector, a matrix or a three-dimensional array of model
responses (depends on the output of |
ee |
|
Notice that the statistics of interest (\mu
, \mu^*
and \sigma
) are not stored. They can be printed by the
print
method, but to extract numerical values, one has to
compute them with the following instructions:
If x$y
is a vector:
mu <- apply(x$ee, 2, mean) mu.star <- apply(x$ee, 2, function(x) mean(abs(x))) sigma <- apply(x$ee, 2, sd)
If x$y
is a matrix:
mu <- apply(x$ee, 3, function(M){ apply(M, 2, mean) }) mu.star <- apply(abs(x$ee), 3, function(M){ apply(M, 2, mean) }) sigma <- apply(x$ee, 3, function(M){ apply(M, 2, sd) })
If x$y
is a three-dimensional array:
mu <- sapply(1:dim(x$ee)[4], function(i){ apply(x$ee[, , , i, drop = FALSE], 3, function(M){ apply(M, 2, mean) }) }, simplify = "array") mu.star <- sapply(1:dim(x$ee)[4], function(i){ apply(abs(x$ee)[, , , i, drop = FALSE], 3, function(M){ apply(M, 2, mean) }) }, simplify = "array") sigma <- sapply(1:dim(x$ee)[4], function(i){ apply(x$ee[, , , i, drop = FALSE], 3, function(M){ apply(M, 2, sd) }) }, simplify = "array")
It is highly recommended to use the function with the argument
scale = TRUE
to avoid an uncorrect interpretation of factors that
would have different orders of magnitude.
when generating the design of experiments, identical repetitions are removed, leading to a lower number than requested.
Gilles Pujol, with contributions from Frank Weber (2016)
M. D. Morris, 1991, Factorial sampling plans for preliminary computational experiments, Technometrics, 33, 161–174.
F. Campolongo, J. Cariboni and A. Saltelli, 2007, An effective screening design for sensitivity, Environmental Modelling and Software, 22, 1509–1518.
G. Pujol, 2009, Simplex-based screening designs for estimating metamodels, Reliability Engineering and System Safety 94, 1156–1160.
morrisMultOut
# Test case : the non-monotonic function of Morris
x <- morris(model = morris.fun, factors = 20, r = 4,
design = list(type = "oat", levels = 5, grid.jump = 3))
print(x)
plot(x)
library(rgl)
plot3d.morris(x) # (requires the package 'rgl')
# Only for demonstration purposes: a model function returning a matrix
morris.fun_matrix <- function(X){
res_vector <- morris.fun(X)
cbind(res_vector, 2 * res_vector)
}
x <- morris(model = morris.fun_matrix, factors = 20, r = 4,
design = list(type = "oat", levels = 5, grid.jump = 3))
plot(x, y_col = 2)
title(main = "y_col = 2")
# Also only for demonstration purposes: a model function returning a
# three-dimensional array
morris.fun_array <- function(X){
res_vector <- morris.fun(X)
res_matrix <- cbind(res_vector, 2 * res_vector)
array(data = c(res_matrix, 5 * res_matrix),
dim = c(length(res_vector), 2, 2))
}
x <- morris(model = morris.fun_array, factors = 20, r = 4,
design = list(type = "simplex", scale.factor = 1))
plot(x, y_col = 2, y_dim3 = 2)
title(main = "y_col = 2, y_dim3 = 2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.