Advertisement
Guest User

Untitled

a guest
May 4th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. mix = sample(0:1, 1000, rep=T)
  2. x = mix*rnorm(500, 100, 15) + (1-mix)*rnorm(500, 150, 20)
  3. mean(x); sd(x)
  4. ## 126.7677
  5. ## 30.89346
  6.  
  7. shapiro.test(x)
  8.  
  9. ## Shapiro-Wilk normality test
  10.  
  11. ## data: x
  12. ## W = 0.9703, p-value = 2.043e-13
  13.  
  14. mix = sample(0:1, 1000, rep=T, prob=c(.20, .80))
  15. y = mix*rnorm(500, 100, 15) + (1-mix)*rnorm(500, 115, 20)
  16. shapiro.test(y)
  17.  
  18. ## Shapiro-Wilk normality test
  19.  
  20. ## data: y
  21. ## W = 0.9966, p-value = 0.02869
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement