We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code appears to evaluate costly diag <- coda::geweke.diag(mcmcobj, frac1 = frac1, frac2 = frac2) even when results are not used.
diag <- coda::geweke.diag(mcmcobj, frac1 = frac1, frac2 = frac2)
trace
Current code
convergence.test.Rcpp_MCMCAlgorithm function (object, samples = 10, frac1 = 0.1, frac2 = 0.5, thin = 1, plot = FALSE, what = "Mutation", mixture = 1) { trace <- object$getLogPosteriorTrace() loglik.trace <- object$getLogPosteriorTrace() trace.length <- length(loglik.trace) start <- max(1, trace.length - samples) mcmcobj <- coda::mcmc(data = loglik.trace[start:trace.length], thin = thin) diag <- coda::geweke.diag(mcmcobj, frac1 = frac1, frac2 = frac2) if (plot) { coda::geweke.plot(mcmcobj, frac1 = frac1, frac2 = frac2) } else { return(diag) } }
Proposed code
convergence.test.Rcpp_MCMCAlgorithm function (object, samples = 10, frac1 = 0.1, frac2 = 0.5, thin = 1, plot = FALSE, what = "Mutation", mixture = 1) { loglik.trace <- object$getLogPosteriorTrace() trace.length <- length(loglik.trace) start <- max(1, trace.length - samples) mcmcobj <- coda::mcmc(data = loglik.trace[start:trace.length], thin = thin) if (plot) { coda::geweke.plot(mcmcobj, frac1 = frac1, frac2 = frac2) } else { diag <- coda::geweke.diag(mcmcobj, frac1 = frac1, frac2 = frac2) return(diag) } }
The text was updated successfully, but these errors were encountered:
Looking at R/traceObject.R, it appears that it doesn't need to be fixed.
convergence.test.Rcpp_Trace <- function(object, samples = 10, frac1 = 0.1, frac2 = 0.5, thin = 1, plot = FALSE, what = "Mutation", mixture = 1) { . . . mcmcobj <- coda::mcmc(data=current.trace, start=start, thin=thin) if(plot){ coda::geweke.plot(mcmcobj, frac1=frac1, frac2=frac2) } else{ diag <- coda::geweke.diag(mcmcobj, frac1=frac1, frac2=frac2) return(diag) } }
Sorry, something went wrong.
No branches or pull requests
Code appears to evaluate costly
diag <- coda::geweke.diag(mcmcobj, frac1 = frac1, frac2 = frac2)
even when results are not used.trace
Current code
Proposed code
The text was updated successfully, but these errors were encountered: