Skip to content

Commit

Permalink
Compare lags to number of iterations
Browse files Browse the repository at this point in the history
Otherwise, an error was generated: now it's only a warning, we
plot as far as we can.
  • Loading branch information
jucor committed Jun 26, 2013
1 parent 16aa140 commit be37820
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/ggs_autocorrelation.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ ggs_autocorrelation <- function(D, family=NA, nLags=50) {
D <- get_family(D, family=family)
}

nIter <- attr(D, 'nIteration')
if (nIter < nLags) {
warning(sprintf('nLags=%d is larger than number of iterations, computing until max possible lag %d', nLags, nIter))
nLags <- nIter
}

wc.ac <- ddply(D, c("Parameter", "Chain"), here(summarise), .inform=TRUE,
Autocorrelation=ac(value, nLags),
Lag=1:nLags,
Expand Down

0 comments on commit be37820

Please sign in to comment.