Learn R Programming

SimDesign (version 0.3)

bias: Compute (relative) bias summary statistic

Description

Computes the (relative) bias of a sample estimate from the population value. Accepts observed and population values, as well as observed values which are in deviation form. If relative bias is requested the observed and population inputs are both required.

Usage

bias(observed, population = NULL, relative = FALSE)

Arguments

observed
a numeric vector of parameter estimates, where the length is equal to the number of replications
population
a numeric scalar indicating the fixed population value. If NULL, then it will be assumed that the observed input is in a deviation form (therefore mean(observed) will be returned)
relative
logical; compute the relative bias statistic? Default is FALSE

Value

  • returns a single number indicating the overall (relative) bias in the estimates

Examples

Run this code
pop <- 2
samp <- rnorm(100, 2, sd = 0.5)
bias(samp, pop)
bias(samp, pop, relative = TRUE)

dev <- samp - pop
bias(dev)

# equivalent here
bias(mean(samp), pop)

Run the code above in your browser using DataLab