levenes.test: Levene's Test for Homogeneity of Variance

Description Usage Arguments Value See Also Examples

View source: R/levenes.test.R

Description

Function to test the homogeneity of variance for two populations, an assumption of the independent samples t-test. The null hypothesis tested is that the two population variances are equal; the alternative is that the two population variances are not equal.

Usage

1

Arguments

y

outcome variable of interest, given as a numeric object.

group

a factor or character object with two levels indicating group membership.

Value

An anova table containing test results: two values for degrees of freedom, the F-value, and the p-value.

See Also

t.test

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# using simple data frame
value = c(7,2,4,4,8,3,61,2,80,4)
grp = rep(c("A","B"), each = 5)
ex_data = data.frame(value = value, grp = grp)
levenes.test(ex_data$value, group = ex_data$grp)

# using variable without NA values
levenes.test(NELS$famsize, group = NELS$gender)

# using variable with NA values
levenes.test(NELS$achrdg12, group = NELS$gender)

Example output

Levene's Test for Homogeneity of Variance
      Df F value    Pr(>F)    
group  1  45.615 0.0001445 ***
       8                      
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Levene's Test for Homogeneity of Variance
       Df F value Pr(>F)
group   1  0.7005  0.403
      498               
Levene's Test for Homogeneity of Variance
       Df F value  Pr(>F)  
group   1  4.1273 0.04273 *
      498                  
---
Signif. codes:  0***0.001**0.01*0.05.’ 0.1 ‘ ’ 1

sur documentation built on Aug. 26, 2020, 1:06 a.m.

Related to levenes.test in sur...