Way to ignore variables

185 views
Skip to first unread message

William Beard

unread,
Jul 30, 2015, 1:49:30 PM7/30/15
to Stan users mailing list
Is there a way to prevent variables from the parameters block from being reported in the output csv? I believe intermediate variables defined in the model block are ignored, but I think the model block isn't the place to define variables with constraints; I get the following message when I try 
vector<lower=0>[5] forgetVar;
 in the model block:
SYNTAX ERROR, MESSAGE(S) FROM PARSER: require unconstrained. found range constraint.

Basically, I'm more interested in the hierarchical priors, and there are many space-consuming parameters that depend on these that I'm not interested in.

Ben Goodrich

unread,
Jul 30, 2015, 1:59:54 PM7/30/15
to Stan users mailing list, wcbe...@gmail.com, wcbe...@gmail.com
On Thursday, July 30, 2015 at 1:49:30 PM UTC-4, William Beard wrote:
Is there a way to prevent variables from the parameters block from being reported in the output csv?

Not in CmdStan. In RStan, there is a pars argument that takes a character vector of parameter names and an include flag indicating whether to include or exclude the parameters named in pars from the output.
 
I believe intermediate variables defined in the model block are ignored, but I think the model block isn't the place to define variables with constraints

The model block does not permit constraints (so you will get that parser error) but moreover, your Stan program is likely miswritten if you were trying to do that.

Ben

Krzysztof Sakrejda

unread,
Jul 30, 2015, 2:13:10 PM7/30/15
to Stan users mailing list, wcbe...@gmail.com
On Thursday, July 30, 2015 at 1:49:30 PM UTC-4, William Beard wrote:
Is there a way to prevent variables from the parameters block from being reported in the output csv?

It's a problem I run in to a fair bit but I haven't found a great solution to this.  I don't mind the parameters all being written to file since I _might_ want them but when I try to load the file into something (R) to analyze it ends up being a nuisance to load the whole file.  The closest I see for a convenient solution is something like csvkit (https://csvkit.readthedocs.org/en/0.9.1/cli.html) which makes it easier to subset by columns but last I tried it had trouble ignoring the metadata parts of the file. 

Krzysztof
 

Avraham Adler

unread,
Jul 30, 2015, 2:17:12 PM7/30/15
to Stan users mailing list, krzysztof...@gmail.com, wcbe...@gmail.com, krzysztof...@gmail.com
If you are loading it into R anyway, use rstan and the 'pars' parameter as Ben wrote above.

Avi

Krzysztof Sakrejda

unread,
Jul 30, 2015, 2:20:24 PM7/30/15
to Stan users mailing list, wcbe...@gmail.com, avraha...@gmail.com
On Thursday, July 30, 2015 at 2:17:12 PM UTC-4, Avraham Adler wrote:
If you are loading it into R anyway, use rstan and the 'pars' parameter as Ben wrote above.

That's not something you can do when loading a .csv file as far as I can tell, it's just a feature of running a model through rstan in the first place.  I can't use rstan for the whole workflow because of the data transfer problems. 

Krzysztof
 
Reply all
Reply to author
Forward
0 new messages