SHARE
TWEET

Untitled

a guest Jun 18th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top