Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. set.seed(618)
  2. m = 1000; x = numeric(m); x[1] = 0
  3. for (i in 2:m)
  4. {
  5. if (x[i-1] == 0) x[i] = rbinom(1,1,.9)
  6. else x[i] = rbinom(1,1,.2)
  7. }
  8. table(x)
  9. x
  10. 0 1
  11. 458 542
  12.  
  13. par(mfrow=c(1,3))
  14. plot(x[1:30], type="b", pch=19)
  15. acf(x)
  16. acf(diff(x))
  17. par(mfrow=c(1,1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement