Description Usage Arguments Details Value Author(s) Examples
Performs a permutation (randomization) test for difference in spread (variation) based on independent samples from two populations.
1 2 3 | perm.ind.spread(x, y, parameter, stacked = TRUE, variable = NULL,
alternative = c("two.sided", "less", "greater"),
R = 9999)
|
x |
a numeric vector of observations of the variable (stacked case) or a numeric vector of data values representing the first of the two samples (unstacked case). |
y |
a vector of corresponding population identifiers (stacked case) or a numeric vector of data values representing the second of the two samples (unstacked case). |
parameter |
the spread parameter under consideration (e.g., sd, var). |
stacked |
a logical value (default TRUE) indicating whether the data are stacked. |
variable |
an optional character string that gives the name of the variable under consideration; ignored if stacked is TRUE. |
alternative |
a character string specifying the alternative hypothesis; must be one of "two.sided" (default), "less", or "greater". |
R |
number of replications (default = 9999). |
The null hypothesis is that the distributions of the variable on the two populations are identical—"identical".
The possible alternative hypotheses are:
Two tailed ("two.sided"): The distribution of the variable on the first population has a different spread than that of the variable on the second population—"different.spread".
Left tailed ("less"): The distribution of the variable on the first population has a smaller spread than that of the variable on the second population—"smaller.spread".
Right tailed ("greater"): The distribution of the variable on the first population has a larger spread than that of the variable on the second population—"larger.spread".
A list with class "perm.ts.ind" containing the following components:
Stacked |
TRUE if the data are stacked, FALSE otherwise. |
Perm.values |
the values of the test statistic obtained from the permutations. |
Header |
the main title for the output. |
Variable |
the name of the variable under consideration or NULL. |
Pop.1 |
the first population. |
Pop.2 |
the second population. |
n.1 |
the sample size for the first population. |
n.2 |
the sample size for the second population. |
Statistic |
the test statistic. |
Observed |
the observed value of the test statistic. |
Null |
the null hypothesis; here, always identical. |
Alternative |
the alternative hypothesis. |
P.value |
the P-value or a statement like P < 0.001. |
p.value |
the P-value. |
Neil A. Weiss
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # Manufacturers use the Elmendorf tear test to evaluate material
# strength for various manufactured products.
#
# Elmendorf tear strength, in grams, of two different vinyl floor
# coverings, Brand A and Brand B.
data("elmendorf")
str(elmendorf)
# Note that the data are stacked.
# Permutation test to decide whether there is a difference in spread of
# tear strength for Brand A and Brand B vinyl floor coverings, using the
# standard deviation as the spread parameter.
attach(elmendorf)
perm.ind.spread(STRENGTH, BRAND, sd)
detach(elmendorf) # clean up
# Final-exam scores (out of 40 possible) for two groups of algebra
# students. One group, called the control group, was taught the usual
# algebra course; the other group, called the experimental group, was
# taught by a new teaching method.
data("control")
str(control)
data("experimental")
str(experimental)
# Permutation test to decide whether the new teaching method reduces
# variation in final-exam scores, using the variance as the spread
# parameter.
perm.ind.spread(control, experimental, var, stacked = FALSE,
variable = "Score", alternative = "greater")
|
'data.frame': 20 obs. of 2 variables:
$ BRAND : Factor w/ 2 levels "BRAND.A","BRAND.B": 1 1 1 1 1 1 1 1 1 1 ...
$ STRENGTH: int 2288 2384 2368 2304 2528 2240 2144 2208 2160 2112 ...
RESULTS OF PERMUTATION INDEPENDENT TWO-SAMPLE SPREAD TEST
BASED ON 9999 REPLICATIONS
SUMMARY Variable Pop.1 Pop.2 n.1 n.2 Statistic Observed
STATISTICS STRENGTH BRAND.A BRAND.B 10 10 ratio.sd 0.6426725
HYPOTHESIS Null Alternative P.value
TEST identical different.spread 0.17
num [1:41] 36 35 35 33 32 32 31 29 29 28 ...
num [1:20] 36 35 35 31 30 29 27 27 26 23 ...
RESULTS OF PERMUTATION INDEPENDENT TWO-SAMPLE SPREAD TEST
BASED ON 9999 REPLICATIONS
SUMMARY Variable Pop.1 Pop.2 n.1 n.2 Statistic Observed
STATISTICS Score control experimental 41 20 ratio.var 2.185243
HYPOTHESIS Null Alternative P.value
TEST identical larger.spread 0.019
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.