View source: R/gof_power_adaptive.R
| gof_power_adaptive | R Documentation |
Estimates power in simulation batches and stops when the Monte Carlo
standard error of every reported power estimate is no larger than
target.mcse, or when B.max is reached.
gof_power_adaptive(
pnull,
vals = NA,
rnull,
ralt,
param_alt,
w = function(x) -99,
phat = function(x) -99,
TS,
TSextra,
With.p.value = FALSE,
alpha = 0.05,
Range = c(-Inf, Inf),
nbins = c(50, 10),
rate = 0,
maxProcessor,
minexpcount = 5,
ChiUsePhat = TRUE,
SuppressMessages = FALSE,
target.mcse = 0.01,
B.min = 500,
B.max = 10000,
B.batch = 250,
B.null = 1000,
conf.level = 0.95,
list.with.everything
)
pnull |
Function to calculate the cdf under the null hypothesis. |
vals |
=NA values of a discrete random variable, or NA for continuous data. |
rnull |
Function to generate data under the null hypothesis. |
ralt |
Function to generate data under the alternative hypothesis. |
param_alt |
Vector of parameter values under the alternative. |
w |
Optional weight function; returns -99 if no weights are used. |
phat |
Function to estimate parameters, or function(x) -99. |
TS |
Optional user-supplied test statistic or p-value routine. |
TSextra |
Optional list supplied to TS. |
With.p.value |
=FALSE; TRUE if a user-supplied TS returns p-values. |
alpha |
Significance level. |
Range |
Limits of possible continuous observations. |
nbins |
Number of bins for chi-square tests. |
rate |
Poisson rate if sample size is random; 0 for fixed sample size. |
maxProcessor |
Maximum number of processors used for the statistic-based simulation. P-value and chi-square simulation remains sequential, as in the corresponding existing package routines. |
minexpcount |
Minimum expected bin count for chi-square tests. |
ChiUsePhat |
If TRUE, use estimated parameters in chi-square tests. |
SuppressMessages |
Suppress adaptive progress messages when TRUE. A run-time estimate is still displayed when the estimated maximum run time exceeds 30 seconds. |
target.mcse |
Target Monte Carlo standard error. |
B.min |
Minimum number of alternative simulations per parameter. |
B.max |
Maximum number of alternative simulations per parameter. |
B.batch |
Number of additional alternative simulations per batch. |
B.null |
Number of null simulations used once to estimate the fixed critical values for statistic-based tests. |
conf.level |
Confidence level for Wilson confidence intervals. |
list.with.everything |
Optional case-study list accepted by the package. |
Unlike gof_power(), this routine performs the adaptive simulation
directly. For statistic-based tests it estimates the null critical values
once using B.null null simulations and holds those critical values
fixed while alternative simulations are added in batches.
Statistic-based tests use a two-stage procedure. First, B.null null
data sets are simulated and one set of critical values is estimated. Those
critical values are then held fixed. Alternative data sets are simulated in
batches and exact rejection counts are accumulated.
User tests with With.p.value=TRUE do not require null critical-value
simulation; rejection is determined directly from p-value < alpha.
The package's chi-square tests already perform their own bin construction and
diagnostics. Their rejection counts are accumulated directly from
chi_test_cont() or chi_test_disc(). For discrete data the bin
definitions are selected once for each alternative parameter, matching the
design of chi_power_disc().
An object of class Rgof_power_adaptive and Rgof_power.
It contains power estimates, Monte Carlo standard errors, Wilson confidence
intervals, total alternative simulation count, null simulation count,
convergence information, and (when applicable) the fixed critical values.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.