mtk.designerAddons: The 'mtk.designerAddons' function

Description Usage Arguments Details Value Author(s) References Examples

Description

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.

Usage

1
2
3
4
mtk.designerAddons(where = NULL, library = NULL,
 		authors = NULL, name = NULL,
 		main = NULL, summary = NULL, 
 		plot = NULL, print = NULL)

Arguments

where

NULL or the file containing the R functions to convert into native mtk methods.

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 mtk package.

main

the name of the R function implementing the designer.

summary

NULL or a special version of the summary function provided in the file where.

plot

NULL or a special version of the plot function provided in the file where.

print

NULL or a special version of the print function provided in the file where.

Details

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, ...)

Value

invisible()

Author(s)

Juhui WANG, MIA-Jouy, Inra, Juhui.Wang@jouy.inra.fr

References

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.

Examples

 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)

mtk documentation built on May 2, 2019, 4:15 a.m.