After the meeting a couple weeks ago, I've been thinking
about syntax. I think we want two simultaneous changes:
ld << normal(y | mu, sigma); // drops constants
ld <<< normal(y | mu, sigma); // keeps constants
We could do that --- it would mean that we wouldn't
be able to control proportionality using them as functions.
ld << normal(y|mu, sigma);
There was a case in marginalization of discrete parameters that I needed propto and it wasn't in that context. I can elaborate if you wish.
foo <- normal(y|mu,sigma); // includes constants
bar <- normal(y|mu,sigma)'; // excludes constants
ld << normal(y|mu,sigma); // does whatever y ~ normal(mu, sigma) does now depending on the template parameter
> On Nov 14, 2015, at 12:06 PM, Ben Goodrich <goodri...@gmail.com> wrote:
>
> On Saturday, November 14, 2015 at 11:37:25 AM UTC-5, Marco Inacio wrote:
> There was a case in marginalization of discrete parameters that I needed propto and it wasn't in that context. I can elaborate if you wish.
>
> OK. I think I would still prefer some decoration (like a "prime") rather than variations on the function name or arguments.
I completely agree, but hadn't been thinking along the lines
of symbols.
> foo <- normal(y|mu,sigma); // includes constants
> bar <- normal(y|mu,sigma)'; // excludes constants
I don't like "'" because we use it for transpose
and I'd rather have the decoration on the function name.
How about using "~" as a distribution prefix?
y ~ normal(mu, sigma);
foo <- normal(y | mu, sigma); // includes constants
foo <- _normal(y | mu, sigma); // excludes constants
ld << normal(y | mu, sigma); // does whatever y ~ normal(mu, sigma) does now
I want to reserve ? for the ternary operator, % if we add
a modulus operator
PROPOSAL
==================================
I think minimal and backward-compatiblity perserving for function
notation is best:
<< normal_log(mu | y, sigma);
<< normal_log(y | mu, sigma);
<< normal(y | mu, sigma);
For the case that doesn't include constants, I like the version
that looks like an ordinary function and is spelled out:
<< normal_propto_log(mu | y, sigma);
I could live with putting "td" or "ld" on the LHS of "<<".
I could also live with dropping the "_log" or replacing it
with "_ld", though it's more work and more backward-compatiblity
breaking if we ever move it from deprecated to eliminated.
Is the @save thing once and for all? If not, it'll require
a recompile each usage.
@save[DEBUG] vector[K] beta;
Excellent point on losing constraint checking.
Another issue is which variables are visible in the
generated quantities (or whatever it might be called) block.
What does RStan do for saving?
Yes, but it also introduces something that looks like a variable
that isn't really a variable. Either way, it's a bit of a mess
syntactically.
It's awkward, but then so is poisson_log_ld. Once you start
stacking up suffixes, it's a problem. The real problem is when
you do it on things like negative binomial where there are
two arguments that a transform can apply to.
I could live with this. Or even with norm+ or norm- or +norm
or -norm. I think we want to make these as short as possible
so that they're still readable. The verbosity's getting out
of hand.
binomial<link=logit, norm=true>(y | alpha);
binomial(y | alpha; link = “logit”, norm=“true");
+1
Aki
Me: OK either way
Ben: default to false
Any other opinions?
or
log_lik <- normal_lp<norm=true,sum=false>(y, X * b);
Aki