Learn R Programming

MBASED (version 1.6.0)

getSimulationPvalue: Function to calculate simulations-based p-values

Description

Function to calculate simulations-based p-values

Usage

getSimulationPvalue(observedVal, simulatedVals, direction = "greater", checkArgs = FALSE)

Arguments

observedVal
observed statistic (single number)
simulatedVals
statistics observed in simulations of the outcomes based on assumed null distribution.
direction
one of 'greater' or 'less', depending on the nature of statistic.
checkArgs
single boolean specifying whether arguments should be checked for adherence to specifications. DEFAULT: FALSE

Value

a fraction of simulated statistics that are as or more extreme as the observed one

Details

this function calculates fraction of simulated values (statistics from null distribution) that are >= (direction='greater') or

Examples

Run this code
MBASED:::getSimulationPvalue(observedVal=2, simulatedVals=1:10, direction='greater')
MBASED:::getSimulationPvalue(observedVal=2, simulatedVals=1:10, direction='less')

Run the code above in your browser using DataLab