p_scale | R Documentation |
Simulates data given one or two parent distributions and
returns a p-value testing that the scale of the type distributions are the same.
Default implementation uses Gaussian distributions, however the
distribution function may be modified to
reflect other populations of interest.
Uses ansari.test
or mood.test
for the analysis.
p_scale(
n,
scale,
n2_n1 = 1,
two.tailed = TRUE,
exact = NULL,
test = "Ansari",
parent = function(n, ...) rnorm(n),
...
)
n |
sample size per group |
scale |
the scale to multiply the second group by (1 reflects equal scaling) |
n2_n1 |
sample size ratio |
two.tailed |
logical; use two-tailed test? |
exact |
a logical indicating whether an exact p-value should be computed |
test |
type of method to use. Can be either |
parent |
data generation function (default assumes Gaussian shape). Must be population mean centered |
... |
additional arguments to pass to simulation functions (if used) |
a single p-value
Phil Chalmers rphilip.chalmers@gmail.com
# n=30 per group,
# Distributions Gaussian with sd=1 for first group and sd=2 for second
p_scale(30, scale=2)
p_scale(30, scale=2, test='Mood')
# compare chi-squared distributions
parent <- function(n, df, ...) rchisq(n, df=df) - df
p_scale(30, scale=2, parent=parent, df=3)
# empirical power of the experiments
p_scale(30, scale=2) |> Spower()
p_scale(30, scale=2, test='Mood') |> Spower()
p_scale(30, scale=2, parent=parent, df=3) |> Spower()
p_scale(30, scale=2, test='Mood', parent=parent, df=3) |> Spower()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.