Skip to content

Commit

Permalink
Switch likelihood at calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
richfitz committed Sep 18, 2024
1 parent abe721a commit ba8433e
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 14 deletions.
42 changes: 35 additions & 7 deletions inst/dust/cows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,13 +436,13 @@ class cows {
return data_type{positive_tests};
}

static real_type compare_data(const real_type time,
const real_type dt,
const real_type * state,
const data_type& data,
const shared_state& shared,
internal_state& internal,
rng_state_type& rng_state) {
static real_type compare_data_incidence(const real_type time,
const real_type dt,
const real_type * state,
const data_type& data,
const shared_state& shared,
internal_state& internal,
rng_state_type& rng_state) {
// As in the update function, access the count of outbreaks summed
// over all herds in a region, this week.
const size_t n = shared.n_herds + shared.n_regions;
Expand All @@ -469,4 +469,32 @@ class cows {
}
return ll;
}

static real_type compare_data_survival(const real_type time,
const real_type dt,
const real_type * state,
const data_type& data,
const shared_state& shared,
internal_state& internal,
rng_state_type& rng_state) {
throw std::runtime_error("Not yet implemented");
return NA_REAL;
}

static real_type compare_data(const real_type time,
const real_type dt,
const real_type * state,
const data_type& data,
const shared_state& shared,
internal_state& internal,
rng_state_type& rng_state) {
if (shared.likelihood_choice == INCIDENCE) {
return compare_data_incidence(time, dt, state, data, shared, internal, rng_state);
} else if (shared.likelihood_choice == SURVIVAL) {
return compare_data_survival(time, dt, state, data, shared, internal, rng_state);
} else {
return NA_REAL;
}
}

};
42 changes: 35 additions & 7 deletions src/cows.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ba8433e

Please sign in to comment.