diffvariance.test: Two Sample Variance Test of Normal Populations

Description Usage Arguments Details Value Examples

View source: R/diffvariance.test.R

Description

diffvariance.test allows to compute hypothesis tests about two population variances in both scenarios: known and unknown population mean.

Usage

1
2
3
4
diffvariance.test(x1 = NULL, x2 = NULL, s1 = NULL, s2 = NULL,
  sc1 = NULL, sc2 = NULL, smu1 = NULL, smu2 = NULL, mu1 = NULL,
  mu2 = NULL, n1 = NULL, n2 = NULL, alternative = "two.sided",
  alpha = 0.05, plot = TRUE, lwd = 1)

Arguments

x1

a numeric vector containing the sample of one population.

x2

a numeric vector containing the sample of the other population.

s1

a single numeric value corresponding with the sample standard deviation of the first sample.

s2

a single numeric value corresponding with the sample standard deviation of the second sample.

sc1

a single numeric value corresponding with the cuasi-standard deviation of the first sample.

sc2

a single numeric value corresponding with the cuasi-standard deviation of the second sample.

smu1

if known, a single numeric value corresponding with the estimation of the standard deviation of the first sample.

smu2

if known, a single numeric value corresponding with the estimation of the standard deviation of the second sample.

mu1

if known, a single numeric corresponding with the mean of one population.

mu2

if known, a single numeric value corresponding with the mean of the other population.

n1

a single number indicating the sample size of x1. By default length of argument x1.

n2

a single number indicating the sample size of x2. By default length of argument x2.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

alpha

single number between 0 and 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

single number indicating the line width of the plot.

Details

The formula interface is applicable when the user provides the sample(s) or values of the sample characteristics (cuasi-standard deviation or sample standard deviation). When mu1 and mu2 or smu1 and smu2 are provided, the function performs the procedure with known population means.

Value

A list with class "lstest" and "htest" containing the following components:

statistic

the value of the test statistic.

parameter

the degrees of the freedom of the F distribution of the test statistic.

p.value

the p-value of the test.

estimate

the ratio of the cuasi-variances of x1 and x2.

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x1 <- rnorm(40, mean = 1, sd = 2)
x2 <- rnorm(60, mean = 2, sd = 1.5)
# unknown population mean
diffvariance.test(x1, x2)
diffvariance.test(x1, sc2 = sd(x2), n2 = length(x2))
diffvariance.test(sc1 = sd(x1), sc2 = sd(x2), n1 = length(x1), n2 = length(x2))
# known population mean
diffvariance.test(x1, x2, mu1 = 1, mu2 = 2)
smu1 <- Smu(x1, mu = 1); smu2 <- Smu(x2, mu = 2)
diffvariance.test(smu1 = smu1, smu2 = smu2, n1 = length(x1), n2 = length(x2))

LearningStats documentation built on April 21, 2021, 9:06 a.m.