I want to customize my likelihood function. In my customized LL, I need the lognormal complementary cumulative distribution function of y. I cannot use lognormal_lccdf as it is the log of what I need. I cannot use 1-lognormal_cdf as I get an error as shown below:
target += 1 -lognormal_cdf(t_0_0_1 | mu_0_0_1, sigma1)
PARSER EXPECTED: "("
Error in stanc(filename, allow_undefined = TRUE) :
failed to parse Stan model '0 Copula-Base' due to the above error.
That PARSER EXPECTED sounds like you’re using an older RStan. Vertical bar notation has not always been applied consistently, try with a comma instead.
However, based on my experiment they result in two different values. Here is how they are calculated:
The first one → calculates CDF for each row and then multiplies all of them. then, subtracts it from 1.
The second one → calculates log(1-CDF) for each row and sums all of them. Then, calculates the exp of it.
I understand how and why the second one works correctly (log(s1) + log(s2) = log(s1.s2)). However, I don’t understand why lognormal_cdf multiplies all CDF values and does not add them?
A CDF produces a probability and combining independent events to a joint event multiplies their probabilities. Why would you want to add probabilities?
And wait, why does your customized LL (log-likelihood) need a CDF instead of a log-CDF?