Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set.seed(618)
- m = 1000; x = numeric(m); x[1] = 0
- for (i in 2:m)
- {
- if (x[i-1] == 0) x[i] = rbinom(1,1,.9)
- else x[i] = rbinom(1,1,.2)
- }
- table(x)
- x
- 0 1
- 458 542
- par(mfrow=c(1,3))
- plot(x[1:30], type="b", pch=19)
- acf(x)
- acf(diff(x))
- par(mfrow=c(1,1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement