scatterplots with time

53 views
Skip to first unread message

Andrew Gelman

unread,
Mar 2, 2015, 4:24:23 PM3/2/15
to stan-...@googlegroups.com, stan...@googlegroups.com
I think that in shinystan it would be good to plot the scatterplot between 2 variables with light lines connecting the dots so that it gives some sense of the trace as well as of the joint distribution of the simulation.

> On Mar 2, 2015, at 8:46 AM, Bob Carpenter <ca...@alias-i.com> wrote:
>
> I agree that's what it looks like. Looks like your
> message cut out. What do the other parameters look like?
> A pairs() plot may help you see what's going on --- often
> two parameters will both jump together.
>
> Having more parameters than data points isn't necessarily
> an issue if you have priors that weakly identify the model.
>
> - Bob
>
>> On Mar 3, 2015, at 12:21 AM, Linas Mockus <linasm...@gmail.com> wrote:
>>
>> Hi,
>>
>> I have problem on interpreting a trace (attached). Can somebody help? It looks there may be two posterior modes and stan is switching between them. Is this correct or there is another explanation? The model is attached. Note that there are more parameters than data points.
>>
>> Than
>>
>> --
>> 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.
>> <trace.png><nb1s4w.stan>
>
> --
> 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.


Jonah

unread,
Mar 3, 2015, 12:15:27 AM3/3/15
to stan...@googlegroups.com, stan-...@googlegroups.com, gel...@stat.columbia.edu
On Monday, March 2, 2015 at 4:24:23 PM UTC-5, Andrew Gelman wrote:
> I think that in shinystan it would be good to plot the scatterplot between 2 variables with light lines connecting the dots so that it gives some sense of the trace as well as of the joint distribution of the simulation.

That'd be nice. What if I add the lines in as the default and also let the user remove them if they want?

Andrew Gelman

unread,
Mar 3, 2015, 4:00:57 PM3/3/15
to stan...@googlegroups.com
Sounds good!
> --
> You received this message because you are subscribed to the Google Groups "stan development mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-dev+u...@googlegroups.com.

Bob Carpenter

unread,
Mar 4, 2015, 1:47:14 AM3/4/15
to stan...@googlegroups.com
If you have 2000 draws and plot lines like this, you'll
get a giant hairball. But for 50 draws it might be
readable.

The lines I'd like to see would correspond to posterior means
and/or estimated density countours. It's often hard to see the posterior
mean among the samples.

- Bob

Jonah

unread,
Mar 4, 2015, 9:05:56 AM3/4/15
to stan...@googlegroups.com
Yeah, the potential for too much clutter is why I'd want the option to control whether the lines are displayed.

I also agree about having the option of seeing the means and contours. Definitely doable.

Michael Betancourt

unread,
Mar 4, 2015, 10:20:59 AM3/4/15
to stan...@googlegroups.com
If you want to be really slick then you can add lines whose opacity varies with the number
of points in the plot (many points the lines go away, few points they become visible). These
are the kinds of applications where you can go crazy with the eye candy.

On Mar 4, 2015, at 2:05 PM, Jonah <jga...@gmail.com> wrote:

> Yeah, the potential for too much clutter is why I'd want the option to control whether the lines are displayed.
>
> I also agree about having the option of seeing the means and contours. Definitely doable.
>

Jonah Sol Gabry

unread,
Mar 4, 2015, 10:49:06 AM3/4/15
to stan...@googlegroups.com
On Wed, Mar 4, 2015 at 10:20 AM, Michael Betancourt <betan...@gmail.com> wrote:
 These are the kinds of applications where you can go crazy with the eye candy.

Very true. 

And yeah, making the opacity of the lines a function of the number of points would be slick, indeed. When I have a chance I can post a demo of that and we can see if it's awesome or confusing (or both). 

Andrew Gelman

unread,
Mar 4, 2015, 4:37:52 PM3/4/15
to stan...@googlegroups.com
If it looks like hairball that’s ok, there’s probably nothing going on and the lines can be removed. Another option is to just plot every 10th point or whatever.

Jonah Sol Gabry

unread,
Mar 4, 2015, 5:47:45 PM3/4/15
to stan...@googlegroups.com
Is this more or less what you had in mind? Two images attached, one with about 150 points and one with about 500 points. 

You received this message because you are subscribed to a topic in the Google Groups "stan development mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-dev/FGZvq-e2U5g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-dev+u...@googlegroups.com.
scatter_with_path1.png
scatter_with_path2.png

Bob Carpenter

unread,
Mar 4, 2015, 6:49:13 PM3/4/15
to stan...@googlegroups.com
As I said, hairball! HMC is just too good at sampling
for this to make a lot of sense. Maybe for problems with
lower n_eff/iteration?

- Bob
> <scatter_with_path1.png><scatter_with_path2.png>

Jonah Sol Gabry

unread,
Mar 4, 2015, 6:54:06 PM3/4/15
to stan...@googlegroups.com
Or more like this one maybe

Andrew Gelman

unread,
Mar 4, 2015, 11:45:32 PM3/4/15
to stan...@googlegroups.com
Yup, exactly.  The idea is that it’s a scatterplot, but if the lines show interesting info, they’re there.

<scatter_with_path1.png><scatter_with_path2.png>

Reply all
Reply to author
Forward
0 new messages