On each trial, a stimulus is shown and subjects were required to make a binary choice to decide whether the stimulus is smaller (choice=0) or larger than 0 (choice=1).
Subsequently, subjects should estimate the magnitude of the stimulus in the continuous dimension.
The likelihood of parameters given the data is the product of the normal pdf and the normal cdf: Likelihood[trial] = normal(...)*normal_pdf(...).
An error occurred when I just coded the sampling process by the product of normal and normal_pdf.
Can Stan implement MCMC with that likelihood?
Thanks for the reply!
I am sorry that I might mislead the problem.
My target is a continuous estimation (e.g., -3, 0, or 1).
And the target is sampled from the product of the normal pdf and cdf.
So, I want to implement a code that samples the target from the product of the normal pdf and cdf: target[t] ~ normal(mu1,sigma1)*normal_pdf(mu2,sigma2)
By the way, should I use += instead of ~?
I am unfamiliar with +=.
Does += indicate sampling?
Because you are specifying the likelihood as a function, rather than a distribution, then you need to use the target += notation.
The target += notation allows you specify the log-likelihood directly, rather than one of the built-in distributions. The Functions Reference for each distribution shows the log-probability function that is used. More information is in this section.
For example, when you call:
y ~ normal(mu, sigma);
This is the same as:
target += normal_lupdf(mu, sigma)
Because you want the likelihood to be:
y ~ normal(mu1,sigma1)*normal_cdf(mu2,sigma2)
This can be specified using the log-probability functions directly:
This is proportional to a skew normal distribution with shape parameter α = 1 if the location and scale parameters are the same. Would it be preferable to use skew_normal_lpdf or one of the variants directly?