simulateT {audit} | R Documentation |
Considered a stratified finite population of accounts where each account is classified as either acceptable or in error. Based on a stratified random sample of accounts an auditor is required to give an upper 95 the population that are in error. Given the sample this uses the posterior distribution from a simple hierarchical Bayes model to simulate possible values for T. The 0.95 quantile for this posterior will be an approximate 95 populations.
simulateT(smp,n,N,grd,R)
smp |
numeric vector of the number of accounts in error in each strata in the sample |
n |
numeric vector of the number of accounts sampled in each strata in the population |
N |
numeric vector of the total number of accounts in each strata in the population |
grd |
numeric vector of values usually taken to be seq(0.0001,0.1499,length = 11) |
R |
an integer which is the number of simulated values of T returned |
A vector of length R containing simulated values of T
Meeden, G. and Sargent, D. (2007) Some Bayesian methods for two auditing problems. Communications in Statistics — Theory and Methods, 36, 2727–2740. doi: 10.1080/03610920701386802.
grd <- seq(0.0001,0.15,length = 11) smp <- c(2,1,0) n <- c(75,50,25) N <- c(5000,3000,2000) as.numeric(quantile(simulateT(smp,n,N,grd,40000),0.95))