Computes all relevant test statistics, parameter estimates, detection rates, and so on.
This is the computational heavy lifting portion of the Monte Carlo simulation.
Usage
Analyse(condition, dat, fixed_objects = NULL)
Arguments
condition
a single row from the design input (as a data.frame), indicating the
simulation conditions
dat
the dat object returned from the Generate function
(usually a data.frame, matrix, vector, or list)
fixed_objects
object passed down from runSimulation
Details
In some cases, it may be easier to change the output to a named list containing
different parameter configurations (e.g., when
determining RMSE values for a large set of population parameters).
The use of try functions is generally not required because the function
is internally wrapped in a try call. Therefore, if a function stops early
then this will cause the function to halt internally, the message which triggered the stop
will be recorded, and Generate will be called again to obtain a different dataset.
That being said, it may be useful for users to throw their own stop commands if the data
should be redrawn for other reasons (e.g., a model terminated correctly but the maximum number of
iterations were reached).
Value
returns a named numeric vector or data.frame with the values of interest
(e.g., p-values, effects sizes, etc), or a list containing values of interest
(e.g., separate matrix and vector of parameter estimates corresponding to elements in
parameters). If a data.frame is returned with more than 1 row then these
objects will be wrapped into list objects
See Also
stop
Examples
## Not run:
myanalyse <- function(condition, dat, fixed_objects = NULL){
# require packages/define functions if needed, or better yet index with the :: operator
require(stats)
mygreatfunction <- function(x) print('Do some stuff')
#wrap computational statistics in try() statements to control estimation problems
welch <- t.test(DV ~ group, dat)
ind <- stats::t.test(DV ~ group, dat, var.equal=TRUE)
# In this function the p values for the t-tests are returned,
# and make sure to name each element, for future reference
ret <- c(welch = welch$p.value,
independent = ind$p.value)
return(ret)
}
## End(Not run)