pairs error

255 views
Skip to first unread message

Michael Betancourt

unread,
Jun 3, 2015, 3:59:59 AM6/3/15
to stan-...@googlegroups.com
What’s the underlying reason for an error message like this,

> pairs(fit, pars=c("theta_1", "theta_2", "theta_3", "theta_4"))
Error in if (!missing(bandwidth) && min(bandwidth) <= 0) stop("'bandwidth' must be strictly positive") :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf

The parameters all exist and, for example, traceplot works fine,

traceplot(fit, pars=c("theta_1", "theta_2", "theta_3", "theta_4"))

Ben Goodrich

unread,
Jun 3, 2015, 7:55:39 AM6/3/15
to stan-...@googlegroups.com, betan...@gmail.com
On Wednesday, June 3, 2015 at 3:59:59 AM UTC-4, Michael Betancourt wrote:
What’s the underlying reason for an error message like this,

> pairs(fit, pars=c("theta_1", "theta_2", "theta_3", "theta_4"))
Error in if (!missing(bandwidth) && min(bandwidth) <= 0) stop("'bandwidth' must be strictly positive") :

It comes from the first line of KernSmooth::bkde2D, which is called by grDevices:::.smoothScatterCalcDensity and autocalculates the bandwidth via

        bandwidth <- diff(apply(x, 2, quantile, probs = c(0.05,
           
0.95), na.rm = TRUE, names = FALSE))/25
 
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf
3: In min(x) : no non-missing arguments to min; returning Inf
4: In max(x) : no non-missing arguments to max; returning -Inf

Is it possible that two consecutive theta values overflowed to Inf? Does

all(is.finite(as.array(fit)))

return TRUE?

Ben

Michael Betancourt

unread,
Jun 3, 2015, 9:50:03 AM6/3/15
to stan-...@googlegroups.com

On Jun 3, 2015, at 2:55 PM, Ben Goodrich <goodri...@gmail.com> wrote:

 it possible that two consecutive theta values overflowed to Inf? Does

all(is.finite(as.array(fit)))

return TRUE?

It returns TRUE — the all the samples are well-behaved and I still get
the error.

Ben Goodrich

unread,
Jun 3, 2015, 5:52:59 PM6/3/15
to stan-...@googlegroups.com, betan...@gmail.com
Is this model in a repo somewhere?

Michael Betancourt

unread,
Jun 4, 2015, 2:40:38 AM6/4/15
to stan-...@googlegroups.com
It’s the GP model and associated data I sent in the other (private)
thread (both model_1 and model_2 have this problem for me).

There aren’t any required libraries for pairs or anything, are there?

--
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.
For more options, visit https://groups.google.com/d/optout.

Ben Goodrich

unread,
Jun 4, 2015, 9:24:19 AM6/4/15
to stan-...@googlegroups.com, betan...@gmail.com
OK, I'll look at it later. It only requires the KernSmooth package, but that should be there.

Ben
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.

Michael Betancourt

unread,
Jun 4, 2015, 9:29:33 AM6/4/15
to stan-...@googlegroups.com
Thanks!
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.

Ben Goodrich

unread,
Jun 7, 2015, 10:47:40 AM6/7/15
to stan-...@googlegroups.com, betan...@gmail.com
Sorry to just now be getting to this. The problem is that theta_4 was commented out of the model and whatever version of rstan you used had a bug in pairs about catching non-existent parameters that somehow got fixed along the way. In any event,

pairs(fit, pars = c("theta_1", "theta_2", "theta_3"))

should work but for diagnostic purposes, you usually want to add "lp__" to pars and condition = "something" to the arguments, where "something" is (a unique abbreviation of) the name of one of the extra parameters like accept_stat__ .

Ben
Reply all
Reply to author
Forward
0 new messages