V

var.test() {stats}
Descripción Argumentos
Realiza una prueba F para comparar las varianzas de dos muestras de poblaciones normales
  • x= vector numérico

  • y= vector numérico

  • alternative= "two.sided" prueba bilateral (por defecto), "greater" prueba por mayor ó "less" prueba por menor. Puede especificar sólo utilizando la letra inicial

# Datos aleatorios
x <- rnorm(50, mean = 0, sd = 2)
y <- rnorm(30, mean = 1, sd = 1)
# var.test()
var.test(x = x,
         y = y,
         alternative = "t")       # Prueba bilateral
## 
##  F test to compare two variances
## 
## data:  x and y
## F = 5.5101, num df = 49, denom df = 29, p-value = 5.45e-06
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   2.768398 10.366780
## sample estimates:
## ratio of variances 
##           5.510093
var.test(x, y, alternative = "g") # Prueba unilateral por derecha
## 
##  F test to compare two variances
## 
## data:  x and y
## F = 5.5101, num df = 49, denom df = 29, p-value = 2.725e-06
## alternative hypothesis: true ratio of variances is greater than 1
## 95 percent confidence interval:
##  3.100109      Inf
## sample estimates:
## ratio of variances 
##           5.510093
var.test(x, y, alternative = "t") # Prueba unilateral por izquierda
## 
##  F test to compare two variances
## 
## data:  x and y
## F = 5.5101, num df = 49, denom df = 29, p-value = 5.45e-06
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
##   2.768398 10.366780
## sample estimates:
## ratio of variances 
##           5.510093