gof_test_cont {Rgof}R Documentation

This function performs a number of gof tests for continuous data

Description

This function performs a number of gof tests for continuous data

Usage

gof_test_cont(
  x,
  pnull,
  rnull,
  qnull,
  phat,
  TS,
  nbins = c(100, 10),
  rate = 0,
  Range = c(-Inf, Inf),
  B = 5000,
  minexpcount = 2,
  maxProcessors = 1,
  doMethod = "Default"
)

Arguments

x

data set

pnull

cdf under the null hypothesis

rnull

routine to generate data under the null hypothesis

qnull

routine to calculate quantiles under null hypothesis

phat

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

Range

=c(-Inf, Inf) limits of possible observations, if any, for chi-square tests

B

=5000 number of simulation runs

minexpcount

=2 minimal expected bin count required

maxProcessors

=1number of processors to use in parallel processing. If missing single processor is used.

doMethod

Methods to include in tests

Value

A list with vectors of test statistics and p values

Examples

# Tests to see whether data comes from a standard normal distribution.
pnull = function(x) pnorm(x)
qnull = function(x) qnorm(x)
rnull = function()  rnorm(100)
x = rnorm(100) 
gof_test_cont(x, pnull, rnull, qnull, doMethod="all")
# Tests to see whether data comes from a normal distribution with 
# mean and standard deviation estimated from the data.
pnull = function(x, p=c(0, 1)) pnorm(x, p[1], ifelse(p[2]>0.001, p[2], 0.001))
qnull = function(x, p=c(0, 1)) qnorm(x, p[1],  ifelse(p[2]>0.001, p[2], 0.001))
rnull = function(p=c(0, 1))  rnorm(100, p[1], ifelse(p[2]>0.001, p[2], 0.001))
phat = function(x) c(mean(x), sd(x))
gof_test_cont(x, pnull, rnull, qnull, phat)


[Package Rgof version 1.2.2 Index]