Learn R Programming

distfreereg (version 1.1)

rejection: Compute rejection rates of a distribution-free test from a compare object

Description

Compute the rejection rates of the tests simulated in a compare object. Specifically, this function estimates the rejection rates of the tests conducted with specified statistics of the hypothesis that the mean function is test_mean when the true mean function is true_mean.

Usage

rejection(object, alpha = 0.05, stat = names(object[["observed_stats"]]), ...)

Value

Data frame containing estimated rejection rates and associated Monte Carlo standard errors, with one row for each combination of stat and alpha elements.

Arguments

object

Object of class compare.

alpha

Numeric vector; specifies the \(\alpha\)-levels to use. Passed as probs argument to quantile.

stat

Character vector; specifies the names of the statistics to use. The default value computes the rejection rate associated with every statistic in object.

...

Additional arguments to pass to quantile to estimate the \(1-\alpha\) quantiles of the distribution of simulated statistics.

Author

Jesse Miller

Warning

The reported Monte Carlo standard error does not account for the uncertainty of the estimation of the \(1-\alpha\) quantiles of the distribution of simulated statistics. The number of Monte Carlo simulations should be large enough to make this estimate sufficiently accurate that it can be considered known for practical purposes. The standard errors of estimated quantiles can be calculated using the mcmcse package.

See Also

distfreereg, compare

Examples

Run this code
# In practice, set "reps" much larger than 20.
set.seed(20240201)
n <- 100
func <- function(X, theta) theta[1] + theta[2]*X[,1]
Sig <- rWishart(1, df = n, Sigma = diag(n))[,,1]
theta <- c(2,5)
X <- matrix(rexp(n, rate = 1))
cdfr <- compare(true_mean = func, true_X = X, true_covariance = list(Sigma = Sig),
                test_mean = func, X = X, covariance = list(Sigma = Sig), reps = 20,
                prog = Inf, theta = theta, theta_init = rep(1, length(theta)))

rejection(cdfr)
rejection(cdfr, stat = "CvM")
rejection(cdfr, alpha = c(0.1, 0.2))

Run the code above in your browser using DataLab