Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set.seed(9719) # this makes the example exactly reproducible
- g1 = rnorm( 50, mean=2, sd=2) # here I generate data w/ different variances
- g2 = rnorm(100, mean=3, sd=3) # & different sample sizes
- my.data = stack(list(g1=g1, g2=g2)) # getting the data into 'stacked' format
- library(car) # this package houses the function
- leveneTest(values~ind, my.data) # here I test for heteroscedasticity:
- # Levene's Test for Homogeneity of Variance (center = median)
- # Df F value Pr(>F)
- # group 1 8.4889 0.004128 **
- # 148
- # ---
- # Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Add Comment
Please, Sign In to add comment