> DOUBLEWhy don't the double and var values match?
> stan::model::gradient, lp = -4.46842
> <true,true> lp = 1
> <true,false> lp = 0
> <false,true> lp = -8.14418
> <false,false> lp = -9.14418
>
> VAR
> <true,true> lp = -4.46842:0
> <true,false> lp = -5.46842:0
> <false,true> lp = -8.14418:0
> <false,false> lp = -4.46842:0
>
>
> It looks like gradient and the var-based <true,true> match,
> as expected.
>
> Propto with all doubles causes everything to drop out other
> than the Jacobian (when activated).
>
> I'm worried about the mismatch in <false,false> (which should
> not drop constants and should not include the jacobian, but it
> turns out to be equivalent to the <true,true> case.
I also don't understand the <true,false> case -- why is that always returning zero?
It seems like propto=true isn't just dropping the normalizing constants it's also
dropping the likelihood itself. Unless I'm misunderstanding how log_prob is
supposed to work?
Sure, I just need to understand the expected behavior first. Which I clearly don't.
> This is why I was thinking it'd make sense to include as a unit
> test the cases that are expected to be the same.
Never mind -- I get it. In the double version everything is a "constant" and hence dropped.
When you call gradient only terms that don't depend on the input parameters are dropped.
On Jul 25, 2014, at 12:11 AM, Michael Betancourt <betan...@gmail.com> wrote:
>> DOUBLE
>> stan::model::gradient, lp = -4.46842
>> <true,true> lp = 1
>> <true,false> lp = 0
>> <false,true> lp = -8.14418
>> <false,false> lp = -9.14418
>>
>> VAR
>> <true,true> lp = -4.46842:0
>> <true,false> lp = -5.46842:0
>> <false,true> lp = -8.14418:0
>> <false,false> lp = -4.46842:0
>>
>>
>> It looks like gradient and the var-based <true,true> match,
>> as expected.
>>
>> Propto with all doubles causes everything to drop out other
>> than the Jacobian (when activated).
>>
>> I'm worried about the mismatch in <false,false> (which should
>> not drop constants and should not include the jacobian, but it
>> turns out to be equivalent to the <true,true> case.
>
> Why don't the double and var values match?
>
> I also don't understand the <true,false> case -- why is that always returning zero?
>
> It seems like propto=true isn't just dropping the normalizing constants it's also
> dropping the likelihood itself. Unless I'm misunderstanding how log_prob is
> supposed to work?
>
>> This is why I was thinking it'd make sense to include as a unit
>> test the cases that are expected to be the same.
>
> Sure, I just need to understand the expected behavior first. Which I clearly don't.
This was super-helpful. I wasn't even aware of the distinction between the "DOUBLE" and "VAR" cases described above.
OK so my question to everyone now is this: I want to get the version of log_prob that corresponds to Bob's "VAR<true, true>" case. But I don't want to compute a gradient (at that point in the code).
Can I do this with double (in Eigen Vector/Matrix/whatever) inputs? Or do I need to convert my inputs to stan::agrad::var objects? (If the latter, how should I go about doing that efficiently/safely?)
Thanks!
Alp