Question about vectorization statement

In the following simple “mixing gaussians” model (with 2 components), I’m not able to understand why the “Vectorized” form is NOT producing the same result as the “loop” form (see code below).
From my understanding this statements should be identical. What I’m I doing wrong?
Thank You

data {
int N;
real y[N];
}

parameters {
simplex[2] theta;
ordered[2] mu;
vector<lower=0>[2] sigma;
}

model {
sigma ~ lognormal(0,2);
mu ~ normal(0, 10);

//THIS DOES NOT WORK LIKE EXPECTED!!
target += log_sum_exp(log(theta[1])+normal_lpdf(y | mu[1], sigma[1]),log(theta[2])+normal_lpdf(y | mu[2], sigma[2]));

//THIS WORK!!
//for(n in 1:N)
// target += log_sum_exp(log(theta[1])+normal_lpdf(y[n] | mu[1], sigma[1]),log(theta[2])+normal_lpdf(y[n] | mu[2], sigma[2]));
}

This is discussed on Pg 194 of the Stan manual in Section 13.5.

normal_lpdf(y | mu[1], sigma[1]) doesn’t return a vector containing the values of the PDFs, instead it multiplies them all together. This is a different model entirely than what you want!

@Douglas,
Thank You for pointing me to the right direction.
You guys are doing an amazing work: I can not hope for better support!
Thank You!

It’s not just the devs—it’s a group effort now. Thanks, everyone!