Nothing
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#' Find test statistics for continuous data
#'
#' @param x A numeric vector.
#' @param Fx numeric vector of cdf probabilities.
#' @param param parameters for pnull
#' @param qnull An R function, the quantile function under the null hypothesis.
#' @keywords internal
#' @return A numeric vector with test statistics
TS_cont <- function(x, Fx, param, qnull) {
.Call(`_Rgof_TS_cont`, x, Fx, param, qnull)
}
#' Find test statistics for discrete data
#'
#' @param x An integer vector.
#' @param Fx A numeric vector of cumulative probabilities.
#' @param nm A matrix of pre-calculated (with nm_calc.cpp) numbers needed for Zhangs tests.
#' @param vals A numeric vector with the values of the discrete rv.
#' @keywords internal
#' @return A vector with test statistics
TS_disc <- function(x, Fx, nm, vals) {
.Call(`_Rgof_TS_disc`, x, Fx, nm, vals)
}
#' count occurances in bins. Useful for power calculations. Replaces hist command from R.
#'
#' @param x numeric vector
#' @param bins numeric vector
#' @keywords internal
#' @return Integer vector of counts
bincounter_cpp <- function(x, bins) {
.Call(`_Rgof_bincounter_cpp`, x, bins)
}
#' routine to bin continuous data and assure expected counts>5
#'
#' @param x A numeric vector of numbers.
#' @param pnull function to find CDF
#' @param param parameter of pnull
#' @param k =10, number of bins
#' @param which =1, 1=equal probability bins, 2-equal size bins
#' @param Range =(-99999,99999) limits of possible observations, if any
#' @param minexpcount =2 minimal expected bin count required
#' @keywords internal
#' @return A vectors of bin edges
binner_cont <- function(x, pnull, param, k = 10L, which = 1L, Range = as.numeric( c(-99999,99999)), minexpcount = 2) {
.Call(`_Rgof_binner_cont`, x, pnull, param, k, which, Range, minexpcount)
}
#' routine to bin discrete data and assure expected counts>5
#'
#' @param x An integer vector of counts.
#' @param p cumulative distribution function values at vals
#' @param k number of desired bins
#' @param minexpcount =2 minimal expected bin count required
#' @keywords internal
#' @return An integer vector of indices
binner_disc <- function(x, p, k = 10L, minexpcount = 2) {
.Call(`_Rgof_binner_disc`, x, p, k, minexpcount)
}
#' chi square statistic for continuous data
#'
#' @param param Vector of parameters of pnull
#' @param x Vector of observations
#' @param pnull Function to calculate probabilities (pmf)
#' @param bins bins to use
#' @param formula type of chi square formula to use
#' @param rate rate of Poisson if sample size is random, 0 otherwise
#' @keywords internal
#' @return chi square statistic
chi_stat_cont <- function(param, x, pnull, bins, formula, rate = 0.0) {
.Call(`_Rgof_chi_stat_cont`, param, x, pnull, bins, formula, rate)
}
#' chi square statistic for discrete data
#'
#' @param param parameter for pnull
#' @param x Vector of observations
#' @param pnull cumulative distribution function under the null hypothesis
#' @param bins vector of indices of bins
#' @param formula type of chi square formula to use
#' @param rate rate of Poisson if sample size is random, 0 otherwise
#' @keywords internal
#' @return chi square statistic
chi_stat_disc <- function(param, x, pnull, bins, formula, rate = 0.0) {
.Call(`_Rgof_chi_stat_disc`, param, x, pnull, bins, formula, rate)
}
#'
#' This function performs a number of chisquare gof tests for continuous data
#' @param x data set
#' @param pnull cdf under the null hypothesis
#' @param param starting values of multi-D minimum chi square minimization
#' @param nbins =c(100, 10) number of bins for chisquare tests
#' @param formula Formula of chi square to use
#' @param rate rate of Poisson if sample size is random
#' @param Range =(-99999, 99999) limits of possible observations, if any
#' @param Minimize Should minimum chi square be found?
#' @param minexpcount =2 minimal expected bin count required
#' @keywords internal
#' @return A numeric matrix of test statistics, degrees of freedom and p values
chi_test_cont <- function(x, pnull, param, formula = "Pearson", rate = 0.0, nbins = as.integer( c(100, 10)), Range = as.numeric( c(-99999, 99999)), Minimize = 0L, minexpcount = 2.0) {
.Call(`_Rgof_chi_test_cont`, x, pnull, param, formula, rate, nbins, Range, Minimize, minexpcount)
}
#'
#' This function performs a number of chisquare gof tests for discrete data
#' @param x data set
#' @param pnull cdf under the null hypothesis
#' @param param starting values of multi-D minimum chi square minimization
#' @param nbins =c(100, 10) number of bins for chisquare tests
#' @param formula type of chi square formula to use
#' @param rate rate of Poisson if sample size is random, 0 otherwise
#' @param Minimize Should minimum chi square be found?
#' @param minexpcount =2 minimal expected bin count required
#' @keywords internal
#' @return A numeric matrix of test statistics, degrees of freedom and p values
chi_test_disc <- function(x, pnull, param, nbins = as.integer( c(100, 10)), formula = "Pearson", rate = 0.0, Minimize = 0L, minexpcount = 2.0) {
.Call(`_Rgof_chi_test_disc`, x, pnull, param, nbins, formula, rate, Minimize, minexpcount)
}
#' run gof tests for continuous data
#'
#' @param x A numeric vector of data
#' @param pnull R function (cdf)
#' @param rnull R function (generate data under null hypothesis)
#' @param qnull R function (quantiles under null hypothesis)
#' @param phat function to set or estimate parameters of pnull
#' @param TS function that calculates test statistics
#' @param B (=5000) Number of simulation runs
#' @keywords internal
#' @return A matrix of numbers
gof_cont <- function(x, pnull, rnull, qnull, phat, TS, B = 5000L) {
.Call(`_Rgof_gof_cont`, x, pnull, rnull, qnull, phat, TS, B)
}
#' run gof tests for discrete data
#'
#' @param x an integer vector of counts
#' @param pnull cumulative distribution function under the null hypothesis
#' @param rnull R function (generate data under null hypothesis)
#' @param vals numeric vector of values of discrete random variables.
#' @param phat function to estimate parameters
#' @param TS function that calculates test statistics
#' @param rate =0 rate of Poisson if sample size is random, 0 otherwise.
#' @param B (=5000) Number of simulation runs
#' @keywords internal
#' @return A matrix of numbers
gof_disc <- function(x, pnull, rnull, vals, phat, TS, rate = 0, B = 5000L) {
.Call(`_Rgof_gof_disc`, x, pnull, rnull, vals, phat, TS, rate, B)
}
#' calculate a matrix of numbers needed for Zhangs tests for discrete data
#'
#' @param n An integer.
#' @keywords internal
#' @return A matrix of numbers
nm_calc <- function(n) {
.Call(`_Rgof_nm_calc`, n)
}
#' find power of gof tests for continuous data
#'
#' @param pnull R function (cdf)
#' @param rnull R function (generate data under null hypothesis)
#' @param qnull R function (quantiles under null hypothesis)
#' @param ralt R function to generate data under alternative
#' @param param_alt parameters of ralt
#' @param phat function to estimate parameters from the data
#' @param TS function to calculate test statistics
#' @param nbins =c(100,10) number of bins to use
#' @param rate rate of Poisson if sample size is random
#' @param Range =(-99999, 99999) limits of possible observations, if any
#' @param B =c(1000, 1000) Number of simulation runs for power and null distribution
#' @param alpha =0.05, type I error of test
#' @param minexpcount =2 minimal expected bin count required
#' @keywords internal
#' @return A matrix of powers
power_cont <- function(pnull, rnull, qnull, ralt, param_alt, phat, TS, nbins = as.integer( c(100, 10)), rate = 0.0, Range = as.numeric( c(-99999, 99999)), B = as.integer( c(1000, 1000)), alpha = 0.05, minexpcount = 2.0) {
.Call(`_Rgof_power_cont`, pnull, rnull, qnull, ralt, param_alt, phat, TS, nbins, rate, Range, B, alpha, minexpcount)
}
#' find power of gof tests for discrete data
#'
#' @param pnull R function (cdf)
#' @param rnull R function (generate data under null hypothesis)
#' @param vals vector of values of discrete random variable
#' @param ralt R function to generate data under alternative
#' @param param_alt parameters of function ralt
#' @param phat function to estimate parameters from the data
#' @param TS function to calculate test statistics
#' @param nbins =c(100,10) number of bins to use
#' @param rate rate of Poisson if sample size is random, 0 otherwise
#' @param B =c(1000, 1000) Number of simulation runs for power and null distribution
#' @param alpha =0.05, type I error of test
#' @param minexpcount =2 minimal expected bin count required
#' @keywords internal
#' @return A matrix of powers
power_disc <- function(pnull, rnull, vals, ralt, param_alt, phat, TS, nbins = as.integer( c(100, 10)), rate = 0.0, B = as.integer( c(1000, 1000)), alpha = 0.05, minexpcount = 2.0) {
.Call(`_Rgof_power_disc`, pnull, rnull, vals, ralt, param_alt, phat, TS, nbins, rate, B, alpha, minexpcount)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.