Description Usage Arguments Value Author(s) See Also Examples
View source: R/setSelection.parameterDef.r
setSelection sets the banker parameters of a parameterDef object. setSelection are "call by reference", so assignment is not needed to update the parameterDef object. In other words, they will overwrite the value of its argument(parameterDef object).
parameterDef is a short hand of "parameter definition". It defines parameters used by the dgp
which is the most important part of a simulation. For each simulation,There is a particular set of parameter. parameterDef allow us to define several parameters for different simulation at once. There are two types of parameter in parameterDef, scalar parameters and other parameters.
Scalar parameters must be a scalar. Any vectors or matrix is regarded as a sequence of scalar parameters. For example, n=seq(10,50,10), first simulation takes n=10, second simulation takes n=20 and so on.
Other parameters can be anything and it is banker over the scalar parameters.
For example, we would like to know how would the sample size affect the variance of the sample mean of normally distributed variable. We can set n=seq(10,50,10), mean=1 and sd=2. (see example)#'
1 2 | ## S3 method for class 'parameterDef'
setSelection(x,...)
|
x |
A parameterDef object |
... |
Variables to be added to a parameterDef object |
A parameterDef object
TszKin Julian Chan ctszkin@gmail.com
setSelection.parameterDef
,createParDef
,evalFunctionOnParameterDef
,generate.parameterDef
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | par_def1<-createParDef(selection=list(mean=1,sd=2,n=seq(10,50,10)))
par_def2<-createParDef()
setSelection(par_def2,mean=1,sd=2,n=seq(10,50,10))
identical(par_def1,par_def2)
evalFunctionOnParameterDef(par_def1, function() rnorm(n,mean,sd) ) # 10 random number
evalFunctionOnParameterDef(par_def1, function() rnorm(n,mean,sd), index=3) # 30 random number
generate(par_def1)
# More than 1 selection parameters
par_def3<-createParDef(selection=list(sd=2,mean=1:3,n=seq(10,50,10)))
generate(par_def3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.