Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed redundant global error parameter from affine model. #52

Merged
merged 8 commits into from
Jan 13, 2025
2 changes: 1 addition & 1 deletion R/hmde_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ hmde_affine_single_ind <- function(){
y_obs = NULL,
obs_index = NULL,
time = NULL,
y_bar = NULL,
int_method = NULL,
y_bar = NULL,
prior_means = c(1,1),
prior_sds = c(2,2),
model = "affine_single_ind")
Expand Down
9 changes: 3 additions & 6 deletions inst/stan/affine_single_ind.stan
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//Growth function
functions{
//Growth function for use with Runge-Kutta method
//pars = (beta_0, beta_1, y_bar)
//pars = (const, beta_1, y_bar)
real DE_rk4(real y, array[] real pars){ //change number of pars
return pars[1] - (pars[2] * (y-pars[3])); //growth function
}
Expand Down Expand Up @@ -74,11 +74,8 @@ data {
parameters {
//Individual level
real<lower=0> ind_y_0;
real<lower=0> ind_const;
real ind_const;
real<lower=0> ind_beta_1;

//Global level
real<lower=0> global_error_sigma;
}

// The model to be estimated.
Expand Down Expand Up @@ -125,7 +122,7 @@ model {

//Priors
//Individual level
ind_const ~lognormal(log(prior_means[1]), prior_sds[1]);
ind_const ~normal(prior_means[1], prior_sds[1]);
ind_beta_1 ~lognormal(log(prior_means[2]), prior_sds[2]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-hmde_models_affine.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ test_that("Model structures: affine", {
# Single individual
single_model <- hmde_model("affine_single_ind")
expect_named(single_model, c("step_size", "n_obs", "y_obs", "obs_index",
"time", "y_bar", "int_method", "prior_means",
"time", "int_method", "y_bar", "prior_means",
"prior_sds", "model"))
expect_type(single_model, "list")
expect_visible(single_model)
Expand Down
Loading