gof_test_disc {Rgof} | R Documentation |
This function performs a number of gof tests for discrete data.
Description
This function performs a number of gof tests for discrete data.
Usage
gof_test_disc(
x,
pnull,
rnull,
vals,
phat,
TS,
nbins = c(100, 10),
rate = 0,
B = 5000,
minexpcount = 2,
maxProcessors = 1,
doMethod = "Default"
)
Arguments
x |
data set (the counts) |
pnull |
cumulative distribution function under the null hypothesis |
rnull |
routine to generate data under the null hypothesis |
vals |
a vector of values of discrete random variables |
phat |
a function to estimate parameters from the data |
TS |
user supplied function to find test statistics |
nbins |
=c(100, 10) number of bins for chi-square tests |
rate |
=0 rate of Poisson if sample size is random, 0 if sample size is fixed |
B |
=5000 number of simulation runs |
minexpcount |
=2 minimal expected bin count required |
maxProcessors |
=1 number of processors to use in parallel processing. If missing single processor is used. |
doMethod |
Methods to include in tests |
Value
A numeric matrix of test statistics and p values
Examples
# Tests to see whether data comes from a binomial (10, 0.5) distribution.
vals=0:10
pnull = function() pbinom(0:10, 10, 0.5)
rnull = function() table(c(0:10, rbinom(1000, 10, 0.5)))-1
x = rnull()
gof_test_disc(x, pnull, rnull, vals, doMethod="all")
# Tests to see whether data comes from a binomial distribution with the success probability
# estimated from the data.
pnull = function(p=0.5) pbinom(0:10, 10, ifelse(p>0&&p<1,p,0.001))
rnull = function(p=0.5) table(c(0:10, rbinom(1000, 10, ifelse(p>0&&p<1,p,0.001))))-1
phat = function(x) mean(0:10*x)/1000
gof_test_disc(x, pnull, rnull, vals, phat)
[Package Rgof version 1.2.2 Index]