tailDiag | R Documentation |
Evaluate tail behavior and usability for 2nd - 5th order (terms 1-4) Edgeworth expansions for a t-statistic.
tailDiag(
stats,
n,
type = "short",
df = NULL,
moder = FALSE,
ncheck = 30,
lim = c(1, 7),
verbose = TRUE
)
stats |
named vector of distribution parameters or estimates needed for
Edgeworth expansion. If no names for the vector are provided and the type
is
|
n |
a single value for a sample size summary to be used in Edgeworth expansion. Important: an average (not sum!) of two group sizes for a two-sample test. |
type |
which Edgeworth expansions are to be evaluated: |
df |
degrees of freedom for a first order approximation, a parameter of
Student's t-distribution. If not provided, the value will be calculated
based on arguments |
moder |
|
ncheck |
number of intervals for tail diagnostic. |
lim |
Tail region for tail diagnostic. Provide the endpoints for the right tail (positive values). |
verbose |
if |
Determine if the tails of the Edgeworth expansion behave similarly to a cumulative distribution function and therefore can be used for approximating sampling distribution. The results also provide information on the thickness of the tails of that distribution (thicker tail will behave nicely). The function is evaluated according to three criteria: monotonicity, boundedness by 0 and 1, and being no less conservative than the first order approximation (Student's t-distribution).
Both left and right tails are evaluated. t-distribution-based expansions are used.
If values for stats
are calculated from a sample and type !=
"short"
, it is recommended that smpStats()
is used to create
stats
to make sure that all the necessary statsitics are provided and
are not searched for in parent environments.
A matrix of logical values: four columns for orders 2 through 5, two rows for left and right tails.
smpStats
that creates stats
vector from the
sample.
n <- 10 # sample size
# Gamma distribution with shape parameter \code{shp}
shp <- 3
ord <- 3:6 # orders of scaled cumulants
lambdas <- factorial(ord - 1)/shp^((ord - 2)/2)
tailDiag(lambdas, n)
# from sample
smp <- rgamma(n, shape = 3)
stats <- smpStats(smp)
tailDiag(stats, n)
# two-sample test
n2 <- 8
smp2 <- c(smp, rnorm(n2))
a <- rep(0:1, c(n, n2))
stats2 <- smpStats(smp2, a)
tailDiag(stats2, (n + n2)/2, type = "two-sample")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.