Learn R Programming

mtk (version 1.0)

make.mtkFactor: The make.mtkFactor function

Description

Creates a new input factor and specifies its uncertainty distribution.

Usage

make.mtkFactor(name="unkown", id="unkown", unit="", type="", nominal=NA, distribName='unknown', distribPara=list(), features=list())

Arguments

name
the name of the input factor.
id
the name of the factor in the simulation code, if different from name (optional).
unit
the measurement unit of the factor values (optional). This can be used in graphics or reports, for example.
type
the data-type of the factor's values (optional).
nominal
the nominal value of the factor.
distribName
the name of the probability distribution describing the factor's uncertainty.
distribPara
the list of distribution parameters.
features
the list of factor's features.

Value

mtkFactor.

Details

The distribName argument must use the R terminology, for example norm for the normal distribution or unif for the uniform one; see help(distributions).

Examples

Run this code

# Define a new continuous factor 
	make.mtkFactor("A", distribName="unif", distribPara=list(min=0,max=1))
# Define a new discrete factor 
	make.mtkFactor("D", distribName="discrete", distribPara =
				list(type='categorical', levels=c('a','b','c'), 
				weights=rep(0.33,3))
				)
	

Run the code above in your browser using DataLab