Var.test: Tests of variance(s) for normal distribution(s)

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/global1.R

Description

Classical tests of variance for one-sample, two-independent samples or paired samples.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Default S3 method:
Var.test(x, y = NULL, ratio = 1, alternative = c("two.sided", 
    "less", "greater"), paired = FALSE, conf.level = 0.95, ...)

## S3 method for class 'paired'
Var.test(x, ...)

## Default S3 method:
pitman.morgan.test(x, y = NULL, alternative = c("two.sided", "less", "greater"), 
    ratio = 1, conf.level = 0.95,...)

Arguments

x

first sample or an object of class paired or an object of class lm.

y

second sample or an object of class lm.

ratio

a priori ratio of variances (two-samples) or variance (one-sample).

alternative

alternative hypothesis.

paired

independent (the default) or paired samples.

conf.level

confidence level.

...

further arguments to be passed to or from methods.

Value

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

statistic

the value of the X-squared statistic (one-sample) or F-statistic (two-samples).

parameter

the degrees of freedom for the statistic.

p.value

the p-value for the test.

conf.int

a confidence interval for the parameter appropriate to the specified alternative hypothesis.

estimate

the estimated variance(s).

null.value

the specified hypothesized value of the parameter.

alternative

a character string describing the alternative hypothesis.

method

a character string indicating what type of test was performed.

data.name

a character string giving the name(s) of the data.

Author(s)

Stephane CHAMPELY

References

See Also

bonettseier.Var.test, grambsch.Var.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(HorseBeginners)

#one sample test
Var.test(HorseBeginners$Actual,ratio=15)

# two independent samples test
Var.test(HorseBeginners$Actual,HorseBeginners$Imaginary)

# two dependent samples test
Var.test(HorseBeginners$Actual,HorseBeginners$Imaginary,paired=TRUE)
p<-with(HorseBeginners,paired(Actual,Imaginary))
Var.test(p)

Example output

Loading required package: MASS
Loading required package: gld
Loading required package: mvtnorm
Loading required package: lattice
Loading required package: ggplot2

Attaching package: 'PairedData'

The following object is masked from 'package:base':

    summary


	One-sample variance test

data:  x
X-squared = 19.394, df = 7, p-value = 0.01407
alternative hypothesis: true variance is not equal to 15
95 percent confidence interval:
  18.16785 172.15385
sample estimates:
variance 
41.55964 


	F test to compare two variances

data:  x and y
F = 0.1131, num df = 7, denom df = 7, p-value = 0.01015
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
 0.02264257 0.56491212
sample estimates:
ratio of variances 
         0.1130976 


	Paired Pitman-Morgan test

data:  x and y
t = -3.2675, df = 6, p-value = 0.01709
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
 0.01975295 0.64755197
sample estimates:
variance of x variance of y 
     41.55964     367.46713 


	Paired Pitman-Morgan test

data:  Actual and Imaginary
t = -3.2675, df = 6, p-value = 0.01709
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
 0.01975295 0.64755197
sample estimates:
variance of x variance of y 
     41.55964     367.46713 

PairedData documentation built on May 1, 2019, 6:49 p.m.