stan_drop_chains <- function(object, chain_ids) { if (!is(object, "stanfit")) stop("object must be a fitted rstan object") if (missing(chain_ids)) stop("please select chain numbers to drop for argument 'chain_ids'") ids <- unlist(lapply(object@stan_args, function(l) l$chain_id)) drop <- ids %in% chain_ids if (!any(drop)) stop("chain_ids not found in stanfit object") for (chain in seq_along(drop)) { if (drop[chain]) { object@sim$samples[ids[chain]] <- NULL object@inits[ids[chain]] <- NULL object@sim$permutation[ids[chain]] <- NULL object@stan_args[ids[chain]] <- NULL } } object@sim$chains <- length(which(!drop)) object@sim$n_save <- object@sim$n_save[!drop] object@sim$warmup2 <- object@sim$warmup2[!drop] for (chain in seq_len(object@sim$chains)) { object@stan_args[[chain]]$chain_id <- chain } new_obj <- new( "stanfit", model_name = object@model_name, model_pars = object@model_pars, par_dims = object@par_dims, mode = 0L, sim = object@sim, inits = object@inits, stan_args = object@stan_args, stanmodel = object@stanmodel, date = date(), .MISC = new.env(parent = emptyenv()) ) return(new_obj)}--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Thanks for the suggestion, Michael. So is it always a good idea to run as many chains as your machine can handle to detect problems with the model?
Also, I was wanting to drop chains because I fit a model with a lot of samples, and was wanting to do some some basic plots and working with a subsample to speed up the process without refitting a smaller model with less samples.
Jonah
If I just run one of the example models, save the stanfit object, then reload it into R, I get the same error.