Skip to content

Commit

Permalink
fix gig domain
Browse files Browse the repository at this point in the history
  • Loading branch information
ygeunkim committed Sep 8, 2024
1 parent 31ecd4f commit 21b8a57
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions inst/include/bvharsim.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,13 @@ inline Eigen::VectorXd sim_gig(int num_sim, double lambda, double psi, double ch
for (int i = 0; i < num_sim; ++i) {
res[i] = gamma_rand(abs_lam, 2 / psi); // GIG(shape, 2 * rate, 0) <=> Gamma(shape, rate)
}
} else {
return res;
} else if (lambda < 0) {
for (int i = 0; i < num_sim; ++i) {
res[i] = 1 / gamma_rand(abs_lam, 2 / chi); // GIG(-shape, 0, 2 * scale) <=> Inverse-Gamma(shape, scale)
}
return res;
}
return res;
}
// if (chi < 15 * std::numeric_limits<double>::epsilon()) {
// for (int i = 0; i < num_sim; ++i) {
Expand Down Expand Up @@ -505,12 +506,13 @@ inline Eigen::VectorXd sim_gig(int num_sim, double lambda, double psi, double ch
for (int i = 0; i < num_sim; ++i) {
res[i] = gamma_rand(abs_lam, 2 / psi, rng); // GIG(shape, 2 * rate, 0) <=> Gamma(shape, rate)
}
} else {
return res;
} else if (lambda < 0) {
for (int i = 0; i < num_sim; ++i) {
res[i] = 1 / gamma_rand(abs_lam, 2 / chi, rng); // GIG(-shape, 0, 2 * scale)
}
return res;
}
return res;
}
// if (chi < 8 * std::numeric_limits<double>::epsilon()) {
// for (int i = 0; i < num_sim; ++i) {
Expand Down

0 comments on commit 21b8a57

Please sign in to comment.