variance.test {LearningStats} | R Documentation |
One Sample Variance Test of a Normal Population
Description
variance.test
allows to compute hypothesis tests for the variance of a Normal population in both scenarios: known or unknown population mean.
Usage
variance.test(x = NULL, s = NULL, sc = NULL, smu = NULL, mu = NULL,
n = NULL, sigma02, alternative = "two.sided", alpha = 0.05,
plot = TRUE, lwd = 1)
Arguments
x |
a numeric vector containing the sample. |
s |
a single numeric value corresponding with the sample standard deviation. |
sc |
a single numeric value corresponding with the cuasi-standard deviation. |
smu |
if known, a single numeric value corresponding with the estimation of the standard deviation for known population mean. |
mu |
if known, a single numeric value corresponding with the population mean. Even when the user provides smu, mu is still needed. |
n |
a single positive integer corresponding with the sample size; not needed if the sample is provided. |
sigma02 |
a single number corresponding with the variance to test. |
alternative |
a character string specifying the alternative hypothesis, must be one of
" |
alpha |
a single number in (0,1), significance level. |
plot |
a logical value indicating whether to display a graph including the test statistic value for the sample, its distribution, the rejection region and p-value. |
lwd |
a single number indicating the line width of the plot. |
Details
The formula interface is applicable when the user provides the sample or values of the sample characteristics (cuasi-standard deviation or sample standard deviation).
Value
A list with class "lstest
" and "htest
" containing the following components:
statistic |
the value of the test statistic. |
parameter |
the degrees of freedom of the statistic's distribution. |
p.value |
the p-value of the test. |
estimate |
the cuasi-variance. |
null.value |
the value specified by the null. |
alternative |
a character string describing the alternative. |
method |
a character string indicating the method used. |
data.name |
a character string giving the names of the data. |
alpha |
the significance level. |
dist.name |
a character string indicating the distribution of the test statistic. |
statformula |
a character string with the statistic's formula. |
reject.region |
a character string with the reject region. |
unit |
a character string with the units. |
Examples
x <- rnorm(50, mean = 1, sd = 2)
# unknown population mean
variance.test(x, sigma02 = 3.5)
variance.test(sc = sd(x), n = 50, sigma02 = 3.5)
# known population mean
variance.test(x, sigma02 = 3.5, mu = 1)
smu <- Smu(x, mu = 1)
variance.test(smu = smu, n = 50, sigma02 = 3.5)