Skip to content

deal with zeroes in estimate_truncation #301

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

Merged
merged 4 commits into from
Jul 21, 2022
Merged

deal with zeroes in estimate_truncation #301

merged 4 commits into from
Jul 21, 2022

Conversation

sbfnk
Copy link
Contributor

@sbfnk sbfnk commented Jul 15, 2022

The estimate_truncation function currently can't deal with observed zeroes - this adds a small noise parameter to fix that

@sbfnk sbfnk changed the base branch from master to init_phi July 15, 2022 10:11
@sbfnk sbfnk changed the title initialise phi in esimate_truncation deal with zeroes in estimate_truncation Jul 15, 2022
@sbfnk sbfnk requested a review from seabbs July 15, 2022 10:12
Copy link
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

// log density of truncated latest data vs that observed
for (i in 1:(obs_sets - 1)) {
int start_t = t - obs_dist[i] - trunc_max[1];
for (j in 1:trunc_max[1]) {
obs[start_t + j, i] ~ neg_binomial_2(trunc_obs[j, i], sqrt_phi);
obs[start_t + j, i] ~ neg_binomial_2(trunc_obs[j, i] + sigma, sqrt_phi);
Copy link
Contributor

@seabbs seabbs Jul 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is initialised to a temporary variable it will be faster vs being done in the likelihood.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems mad but can just add it to trunc_obs

@sbfnk sbfnk marked this pull request as draft July 15, 2022 13:01
Base automatically changed from init_phi to master July 15, 2022 13:39
@sbfnk sbfnk marked this pull request as ready for review July 21, 2022 07:44
@sbfnk sbfnk merged commit 535b64e into master Jul 21, 2022
@sbfnk sbfnk deleted the zero_obs branch July 21, 2022 07:45
@sbfnk
Copy link
Contributor Author

sbfnk commented Jul 21, 2022

Merged in the (current) absence of a better solution.

sbfnk added a commit that referenced this pull request May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants