Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. plot(visitors, col="lightgray", ylim=c(0,700000), ylab="Visitors")
  2. par(new=TRUE);
  3. plot(SMA(visitors, 30), ylim=c(0,700000), type='l', col="black", ylab="Visitors")
  4.  
  5. #set up timeseries, ignore first year when visitor counts weren't reliable at all sites
  6. visitors = ts(all$visitor[365:length(all$visitor)], start=1, frequency=365.25);
  7. #add a fictional visitor to each zero day so we can take logarithms
  8. visitors[which(visitors==0)]=1;
  9. #plot decomposition
  10. attribs = decompose(visitors);
  11. plot(attribs);
  12.  
  13. layout(c(2,1))
  14. acf(attribs$random, na.action=na.pass);
  15. pacf(attribs$random, na.action=na.pass);
  16.  
  17. plot(stl(visitors, s.window="periodic"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement