Description Usage Arguments Details Value Author(s) References Examples
A function used to extend the mtk
package with new design methods programmed as R functions.
The mtk.designerAddons
function takes a R file as input and converts it into a mtk
compliant class which
can be seamlessly integrated into the mtk
package.
1 2 3 4 |
where |
NULL or the file containing the R functions to convert into native |
library |
NULL or the name of the package if the R function to convert is included in a package. |
authors |
NULL or information about the authors of the R function. |
name |
a string to name the method when used with the |
main |
the name of the R function implementing the designer. |
summary |
NULL or a special version of the |
plot |
NULL or a special version of the |
print |
NULL or a special version of the |
The main
function must have the following syntax:
main
<- function(factors, distribNames, distribParameters, ...)
where factors
is either a number or a list of strings giving the names of the n
input factors,
distribNames
is a list of string giving the names of the n
probability distributions that describe the factors' uncertainty,
and distribParameters
is a list of n
lists specifying the distribution parameters associated with the uncertainty domains.
The R function main
returns a named list with two elements: the element main
is a data.frame containing the generated experiment design
and the element information
is an optional list that may be used to provide complementary information about the design process and results.
Furthermore, in order to give more advanced data reporting mechanism with the new method, users can redefine the generic functions:
summary(object, ...)
,
plot(x,y, ...)
,
print(x, ...)
invisible()
Juhui WANG, MIA-Jouy, Inra, Juhui.Wang@jouy.inra.fr
J. Wang, H. Richard, R. Faivre, H. Monod (2013). Le package mtk
, une bibliothèque R pour l'exploration numérique des modèles.
In: Analyse de sensibilité et exploration de modèles : Application aux sciences de la nature et de l'environnement
(R. Faivre, B. Iooss, S. Mahévas, D. Makowski, H. Monod, Eds). Editions Quae, Versailles.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # an example implementation of the method "MC" is held in the file
# "inst/extdata/montecarloDesigner.R"
rFile <- "montecarloDesigner.R"
rFile <- paste(path.package("mtk", quiet = TRUE),
"/extdata/",rFile,sep = "")
# to convert this special version of the method "MC"
# to S4 classes compliant with the "mtk" package. The generated "mtk" compliant class
# is called "mtkXXXDesigner.R" where XXX corresponds to the name of the method.
mtk.designerAddons(where=rFile, authors="H. Monod,INRA", name="MC",
main="basicMonteCarlo")
# to use the method "MC" with the package "mtk",
# just source the generated new files
source("mtkMCDesigner.R")
## Use the "mtkMCDesigner" with the "mtk" package in a seamless way:
# 1) Define the factors
x1 <- make.mtkFactor(name="x1", distribName="unif",
distribPara=list(min=-pi, max=pi))
x2 <- make.mtkFactor(name="x2", distribName="unif",
distribPara=list(min=-pi, max=pi))
x3 <- make.mtkFactor(name="x3", distribName="unif",
distribPara=list(min=-pi, max=pi))
ishi.factors <- mtkExpFactors(list(x1,x2,x3))
# 2) Specify a new workflow with the new method
ishiReg <- mtkExperiment(expFactors=ishi.factors,design="MC",
model="Ishigami", analyze="Regression",
designInfo=list(size=20))
# 3) Run the workflow and report the results
run(ishiReg)
summary(ishiReg)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.