Some improvements to StataStan

39 views
Skip to first unread message

Robert Grant

unread,
Aug 18, 2015, 12:10:47 PM8/18/15
to stan development mailing list
I've ironed out some kinks in StataStan, mainly:
1) you can watch progress almost live in the Stata results window; this wasn't possible before in any Stata version under Windows
2) you can write your Stan model code inside a comment block in the Stata .do file, and leave Stata to find it (without having to hard-code the name of the .do file itself); this is a step up on John Thompson's Stata-to-BUGS commands (but you don't have to do it that way - see stan-example.do for the options)

So far so good in Linux and Windows. But if you know of any Stata people with Macs, please ask them to try it out:
https://github.com/stan-dev/statastan/tree/alpha-test
I need to know that it behaves on all three Stata OSs before we call it v0.1.

Cheers
Robert

Bob Carpenter

unread,
Aug 18, 2015, 1:44:09 PM8/18/15
to stan...@googlegroups.com

> On Aug 18, 2015, at 12:10 PM, Robert Grant <rober...@live.com> wrote:
>
> I've ironed out some kinks in StataStan, mainly:
> 1) you can watch progress almost live in the Stata results window; this wasn't possible before in any Stata version under Windows

Neat. We've been talking about doing that in other interfaces
but nobody's ever done it.

> 2) you can write your Stan model code inside a comment block in the Stata .do file, and leave Stata to find it (without having to hard-code the name of the .do file itself); this is a step up on John Thompson's Stata-to-BUGS commands (but you don't have to do it that way - see stan-example.do for the options)

I would much rather recommend that people write standalone Stan
files. I hate having to fish the file out of a string in some
other programming language, and I just don't believe in all this
"literate programming" mixture of presentation, test harness, code,
etc. in a single file.

> So far so good in Linux and Windows. But if you know of any Stata people with Macs, please ask them to try it out:
> https://github.com/stan-dev/statastan/tree/alpha-test
> I need to know that it behaves on all three Stata OSs before we call it v0.1.

We have a lot of Mac OS X users among our developers, and I
think Jonah may be running Stata on the Mac. At least I thought
we were going to buy a license as part of our IES grant which
has a Stata deliverable.

- Bob

Robert Grant

unread,
Aug 18, 2015, 6:11:46 PM8/18/15
to stan...@googlegroups.com

Yeah, it's a bit of a hack but that's the price of working with Windows, I guess. You can see how it works at the top of stan.do in a separate program called windowsmonitor - it could easily get applied to anything else that can't read cout/cerr in real time. Someone over on Statalist thought file contention would be a problem (simultaneous access) but not so far...

The inline code is popular in Rcpp and that's my inspiration. I don't like the Thompson method and spell out why in the stan-example.do file. Nor do I subscribe to the reproducible research mania! But the #1 goal in StataStan is to make grown-up  Bayesian models accessible to people who would be discouraged by working across Stata and Stan separately, so I'm trying to cater to all tastes!

--
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/EAMppwkQnMI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-dev+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bob Carpenter

unread,
Aug 18, 2015, 7:33:58 PM8/18/15
to stan...@googlegroups.com
I like the focus on reproducible research. Or as Andrew might
say, writing code that doesn't get moldy sitting on the shelf.
I just prefer to do it with simple shell scripts and makefiles
rather than embedding my code and docs and using a combination of
markdown and scripting that I can't even find doc for.

I do like knitr and Jupyter for short tutorial material --- there
it's nice to see the code and output all together.

- Bob
> 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.

Jonah

unread,
Aug 19, 2015, 9:17:02 AM8/19/15
to stan development mailing list
Yeah I've got Stata14 on my Mac now so I can test out the latest StataStan on Mac.

Robert Grant

unread,
Aug 19, 2015, 3:22:02 PM8/19/15
to stan...@googlegroups.com

Woo hoo! Thanks Jonah.

On 19 Aug 2015 14:17, "Jonah" <jga...@gmail.com> wrote:
Yeah I've got Stata14 on my Mac now so I can test out the latest StataStan on Mac.

Jonah Sol Gabry

unread,
Aug 19, 2015, 3:46:41 PM8/19/15
to stan...@googlegroups.com
Hi Robert, 

So far it seems to work well on Mac! I'm running it on OS X Yosemite v10.10.5 and I've tried the bernoulli example and a few models of my own. 

The only strange thing I noticed is that if I specify the 'mode' option to do optimization it doesn't just do optimization but also does sampling first (I assume this isn't a Mac issue but just the way StataStan works currently). Is there a way to just do optimization without also doing sampling?

Jonah

Andrew Gelman

unread,
Aug 21, 2015, 4:19:43 PM8/21/15
to stan...@googlegroups.com
This is cool!

> On Aug 18, 2015, at 12:10 PM, Robert Grant <rober...@live.com> wrote:
>
> --
> 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.
Reply all
Reply to author
Forward
0 new messages