Say double x, sigma are given and we want to sample y from the wrapped normal distribution on [0, 1) with mean x and standard deviation sigma.
Can we, in a clever way, obtain the sample y simultaneously with the value q(y) of the density q at y?
Sampling y is, for sure, simple:
std::random_device rd;
std::mt19937 g{ rd() };
std::normal_distribution<> d;
double y = x + sigma * d(g);
y -= std::floor(y);
But now I'd need to compute q(y) separately. Maybe we can obtain q(y) as a byproduct using inverse transform sampling instead.
Remark: If phi denotes the density of the normal distribution with mean 0 and standard deviation sigma and psi(x) denotes the sum of phi(k + x) over all integers k, then the wrapped normal distribution on [0, 1) with mean x and standard deviation sigma has the density q(y) := psi(y - x).
Aucun commentaire:
Enregistrer un commentaire