Learn R Programming

truelies (version 0.2.0)

power_calc: Calculate power to detect non-zero lying

Description

This uses simulations to estimate the power to detect a given level of lying in a sample of size N by this package's methods.

Usage

power_calc(N, P, lambda, alpha = 0.05, prior = stats::dunif,
  nsims = 200)

Arguments

N

Total number in sample

P

Probability of bad outcome

lambda

Probability of a subject lying

alpha

Significance level to use for the null hypothesis

prior

Prior over lambda. A function which takes a vector of values between 0 and 1, and returns the probability density. The default is the uniform distribution.

nsims

Number of simulations to run

Value

Estimated power, a scalar between 0 and 1.

Examples

Run this code
# NOT RUN {
power_calc(N = 50, P = 0.5, lambda = 0.2)

# }

Run the code above in your browser using DataLab