Learn R Programming

SimDesign (version 0.7)

summarise: Summarise simulated data using various population comparison statistics

Description

This collapses the simulation results within each condition to composite estimates such as RMSE, bias, Type I error rates, coverage rates, etc.

Usage

summarise(condition, results, fixed_objects = NULL, parameters_list = NULL)

Arguments

condition
a single row from the design input from runSimulation (as a data.frame), indicating the simulation conditions
results
a data.frame (if analyse returned a numeric vector) or a list (if analyse returned a list) containing the simulation results from analyse, where each cell
fixed_objects
object passed down from runSimulation
parameters_list
an (optional) list containing all the 'parameters' elements generated from generate, where each repetition is stored in a unique element. If a list was not returned from

Value

  • must return a named numeric vector with the desired meta-simulation results

See Also

bias, RMSE, RE, EDR, ECR, MAE

Examples

Run this code
mysummarise <- function(condition, results, fixed_objects = NULL, parameters_list = NULL){

    #convert to matrix for convenience (if helpful)
    cell_results <- do.call(rbind, results)

    # silly test for bias and RMSE of a random number from 0
    pop_value <- 0
    bias.random_number <- bias(sapply(parameters_list, function(x) x$random_number), pop_value)
    RMSE.random_number <- RMSE(sapply(parameters_list, function(x) x$random_number), pop_value)

    #find results of interest here (alpha < .1, .05, .01)
    nms <- c('welch', 'independent')
    lessthan.05 <- EDR(results[,nms], alpha = .05)

    # return the results that will be appended to the design input
    ret <- c(bias.random_number=bias.random_number,
             RMSE.random_number=RMSE.random_number,
             lessthan.05=lessthan.05)
    return(ret)
}

Run the code above in your browser using DataLab