Skip to content

Commit

Permalink
fixed breakages from main update
Browse files Browse the repository at this point in the history
  • Loading branch information
gowerc committed Jun 20, 2024
1 parent 35f0cae commit 6f2d1ad
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 3 deletions.
2 changes: 1 addition & 1 deletion inst/stan/base/functions.stan
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ functions {
return result;
}

matrix if_lt0_else(matrix x, matrix y, matrix replacement) {
matrix if_gte0_else(matrix x, matrix y, matrix replacement) {
int nrow = rows(x);
int ncol = cols(x);
matrix[nrow, ncol] result;
Expand Down
2 changes: 1 addition & 1 deletion inst/stan/lm-claret-bruno/functions.stan
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ functions {
vector ind_p
) {
int nrow = rows(time);
vector[nrow] ind_p_mod = if_lt0_else(time, ind_p, 0);
vector[nrow] ind_p_mod = if_gte0_else(time, ind_p, 0);

vector[nrow] result = fmin(
8000.0,
Expand Down
2 changes: 1 addition & 1 deletion inst/stan/lm-claret-bruno/link_dsld.stan
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ functions {
(1 - exp(- ind_c_matrix .* time))
)
);
return if_lt0_else(time, result_gt0, result_lt0);
return if_gte0_else(time, result_gt0, result_lt0);
}
}
47 changes: 47 additions & 0 deletions tests/testthat/_snaps/LongitudinalClaretBruno.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Print method for LongitudinalClaretBruno works as expected

Code
x <- LongitudinalClaretBruno()
print(x)
Output
Claret-Bruno Longitudinal Model with parameters:
lm_clbr_mu_b ~ normal(mu = 4.09434, sigma = 0.5)
lm_clbr_mu_g ~ normal(mu = 0, sigma = 0.5)
lm_clbr_mu_c ~ normal(mu = -0.91629, sigma = 0.5)
lm_clbr_mu_p ~ normal(mu = 0.69315, sigma = 0.5)
lm_clbr_omega_b ~ lognormal(mu = -1.60944, sigma = 0.5)
lm_clbr_omega_g ~ lognormal(mu = -1.60944, sigma = 0.5)
lm_clbr_omega_c ~ lognormal(mu = -1.60944, sigma = 0.5)
lm_clbr_omega_p ~ lognormal(mu = -1.60944, sigma = 0.5)
lm_clbr_sigma ~ lognormal(mu = -2.30259, sigma = 0.5)
lm_clbr_eta_b ~ std_normal()
lm_clbr_eta_g ~ std_normal()
lm_clbr_eta_c ~ std_normal()
lm_clbr_eta_p ~ std_normal()

---

Code
x <- LongitudinalClaretBruno(sigma = prior_normal(0, 1), mu_g = prior_gamma(2,
1))
print(x)
Output
Claret-Bruno Longitudinal Model with parameters:
lm_clbr_mu_b ~ normal(mu = 4.09434, sigma = 0.5)
lm_clbr_mu_g ~ gamma(alpha = 2, beta = 1)
lm_clbr_mu_c ~ normal(mu = -0.91629, sigma = 0.5)
lm_clbr_mu_p ~ normal(mu = 0.69315, sigma = 0.5)
lm_clbr_omega_b ~ lognormal(mu = -1.60944, sigma = 0.5)
lm_clbr_omega_g ~ lognormal(mu = -1.60944, sigma = 0.5)
lm_clbr_omega_c ~ lognormal(mu = -1.60944, sigma = 0.5)
lm_clbr_omega_p ~ lognormal(mu = -1.60944, sigma = 0.5)
lm_clbr_sigma ~ normal(mu = 0, sigma = 1)
lm_clbr_eta_b ~ std_normal()
lm_clbr_eta_g ~ std_normal()
lm_clbr_eta_c ~ std_normal()
lm_clbr_eta_p ~ std_normal()

9 changes: 9 additions & 0 deletions tests/testthat/_snaps/SimLongitudinalClaretBruno.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# print methods work as expected

Code
print(SimLongitudinalClaretBruno())
Output
A SimLongitudinalClaretBruno Object

0 comments on commit 6f2d1ad

Please sign in to comment.