This function plots the p-value function for a single parameter of interest, estimated via permutations.
two_sample_viz(
null_specification,
x,
y,
alpha = 0.05,
statistic = stat_hotelling,
B = 1000L,
alternative = "two_tail",
type = "exact",
point_estimate = NULL,
confidence_interval = NULL,
lower_bound = 0,
upper_bound = 1,
n_grid_in = 20L,
n_grid_out = 100L,
seed = NULL
)
A function with two arguments y
and parameters
such that F_X = F_{null_specification(Y, parameters)}
under the null
hypothesis.
A list or matrix representing the 1st sample.
A list or matrix representing the 2nd sample.
A scalar specifying the desired significance level. Default is
0.05
.
A character vector specifying the chosen test statistic(s).
These can be stat_hotelling
or user-specified functions that
define desired statistics. See the section User-supplied statistic
function for more information on how these user-supplied functions should
be structured for compatibility with the flipr framwork. Default is
stat_hotelling
.
The number of sampled permutation. Default is 1000L
.
A string specifying whether the p-value is right-tailed,
left-tailed or two-tailed. Choices are "right_tail"
, "left_tail"
and
"two_tail"
. Default is "right_tail"
. Obviously, if the test statistic
used in argument statistic
is positive, all alternatives will lead to the
two-tailed p-value.
A string specifying if performing an exact test through the use
of Phipson-Smyth estimate of the p-value or an approximate test through a
Monte-Carlo estimate of the p-value. Default is "exact"
.
A scalar providing a point estimate of the parameter
under investigation. Default is NULL
, in which case the point estimate is
computed by maximizing the p-value function via the
two_sample_pe
function.
A length-2 numerical vector providing a confidence
interval for the parameter under investigation to be used for setting the
boundaries of the grid onto which the p-value will be displayed. Default is
NULL
, in which case the confidence interval is computed via the
two_sample_ci
function.
A scalar value specifying a rough lower bound of the
interval over which searching the maximum of the p-value function. Default
is 0
.
A scalar value specifying a rough upper bound of the
interval over which searching the maximum of the p-value function. Default
is 1
.
An integer specifying the size of the grid onto which the
p-value function will actually be evaluated. Default is 20L
.
An integer specifying the size of the grid onto which the
p-value function will be extrapolated for display. Default is 100L
.
An integer specifying the seed of the random generator useful for
result reproducibility or method comparisons. Default is NULL
.
A ggplot
object.
# NOT RUN {
x1 <- rnorm(10)
x2 <- rnorm(10, mean = 3)
null_spec <- function(y, parameters) {y - parameters[1]}
# }
# NOT RUN {
two_sample_viz(
null_specification = null_spec,
x = x1,
y = x2,
statistic = stat_t,
B = 10000
)
# }
Run the code above in your browser using DataLab