Guest User

Untitled

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