Guest User

Untitled

a guest
Oct 21st, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. two.way = function(n = 8, mu = 5, alpha = c(2, 3), beta = c(.5, .7),
  2. ab = c(.2, .3, .4, .5) ){
  3.  
  4. m1 = mu + alpha[1] + beta[1] + ab[1]
  5. m2 = mu + alpha[1] + beta[2] + ab[2]
  6. m3 = mu + alpha[2] + beta[1] + ab[3]
  7. m4 = mu + alpha[2] + beta[2] + ab[4]
  8.  
  9. y = c(rnorm(n, m1),
  10. rnorm(n, m2),
  11. rnorm(n, m3),
  12. rnorm(n, m4))
  13.  
  14. A = rep(1:2, each = 2*n)
  15. B = rep(rep(1:2, each = n), 2)
  16.  
  17. anova(aov(y ~ A * B))
  18. }
  19. # Example of use:
  20. two.way()
Add Comment
Please, Sign In to add comment