| gof_test | R Documentation |
This function runs a number of goodness-of-fit tests using Rcpp and parallel
computing. The result is an object of class "Rgof_test". The object
retains the traditional $statistics and $p.values components
and also contains a data-frame representation and metadata about the test.
gof_test(
x,
vals = NA,
pnull,
rnull,
w = function(x) -99,
phat = function(x) -99,
TS,
TSextra,
nbins = c(50, 10),
rate = 0,
Range = c(-Inf, Inf),
B = 5000,
minexpcount = 5,
ChiUsePhat = TRUE,
maxProcessor,
doMethods = "all"
)
x |
Data set. |
vals |
=NA, values of discrete RV, or NA if data is continuous. |
pnull |
CDF under the null hypothesis. |
rnull |
Routine to generate data under the null hypothesis. |
w |
Optional function to calculate weights, returns -99 if no weights. |
phat |
=function(x) -99, function to estimate parameters from the data, or -99 if no parameters are estimated. |
TS |
User supplied function to find test statistics, if any. |
TSextra |
List passed to TS, if desired, or missing. |
nbins |
=c(50, 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. If |
minexpcount |
=5 minimal expected bin count required. |
ChiUsePhat |
=TRUE, if TRUE param is estimated parameter, otherwise minimum chi square method is used. |
maxProcessor |
Number of processors to use in parallel processing. |
doMethods |
="all", a vector of codes for the methods to include or all of them. |
For details on the usage of this routine consult the vignette with
vignette("Rgof", "Rgof").
An object of class "Rgof_test". Its main components are
results, a data frame with method, statistic and p-value;
statistics and p.values, retained for backward
compatibility; parameters, the parameter estimates when present;
and metadata, information about the calculation.
pnull <- function(x) pnorm(x)
rnull <- function() rnorm(100)
x <- rnorm(100)
z <- gof_test(x, NA, pnull, rnull, B=500)
z
z$results
summary(z)
as.data.frame(z)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.