Sorry if this is not the right category.

I want to understand how lp__ is being calculated for a very simple model, say I have a model like this:

```
data {
int<lower = 1> N;
vector[N] y;
}
parameters {
real mu;
real<lower = 0> sigma;
}
model {
target += normal_lpdf(mu | 0, 20);
target += lognormal_lpdf(sigma | 3, 1);
target += normal_lpdf(y | mu, sigma);
}
```

with data:

```
Y <- rnorm(n = 100, mean = 3, sd = 10)
```

I would assume I can get the same value of lp__ for a given sample by doing the following in R:

```
mu <- extract(fit_score)$mu
sigma <- extract(fit_score)$sigma
addmu <- dnorm(x = mu[1], mean = 0, sd = 20, log = TRUE)
addsigma <- dlnorm(x = sigma[1], mean = 3, sd = 1, log = TRUE)
addY <- sum(dnorm(Y, mu[1], sigma[1], log = TRUE))
lp <- addmu + addsigma + addY
```

But I don’t, I get similar values -371 by hand and -369 with `extract(fit_score)$lp__[1]`

. Is this because of differences between dnorm/dlnorm and stan lpdf? Or is there something else that is added or not added in Stan in comparison with my R code?