Skip to content

Commit

Permalink
add docs for new specific methods
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs committed Jun 10, 2024
1 parent 2166459 commit f030342
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Generates priors for the observation error model. This should return a named tup
end

@doc raw"
Generates the observation error distribution for the observation error model. This function should return the distribution for the observation error given the expected observation value `Y_t` and the priors generated by `generate_observation_error_priors`.
The observation error distribution for the observation error model. This function should return the distribution for the observation error given the expected observation value `Y_t` and the priors generated by `generate_observation_error_priors`.
"
function observation_error(obs_model::AbstractTuringObservationErrorModel, Y_t)
@info "No concrete implementation for `observation_error` is defined."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,19 @@ struct NegativeBinomialError{S <: Sampleable, T <: AbstractFloat} <:
end
end

@doc raw"
Generates observation error priors based on the `NegativeBinomialError` observation model. This function generates the cluster factor prior for the negative binomial error model.
"
@model function generate_observation_error_priors(
obs_model::NegativeBinomialError, Y_t, y_t)
cluster_factor ~ obs_model.cluster_factor_prior
sq_cluster_factor = cluster_factor^2
return (; sq_cluster_factor)
end

@doc raw"
This function generates the observation error model based on the negative binomial error model with a positive shift. It dispatches to the `NegativeBinomialMeanClust` distribution.
"
function observation_error(obs_model::NegativeBinomialError, Y_t, sq_cluster_factor)
return NegativeBinomialMeanClust(Y_t + obs_model.pos_shift,
sq_cluster_factor)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@doc raw"
The `PoissonError` struct represents an observation model for Poisson errors. It
is a subtype of `AbstractTuringObservationErrorModel`. Note that
when Y_t is shorter than y_t, then the first `length(y_t) - length(Y_t)` elements of y_t are assumed to be missing.
is a subtype of `AbstractTuringObservationErrorModel`.
## Constructors
- `PoissonError(; pos_shift::AbstractFloat = 0.)`: Constructs a `PoissonError`
Expand All @@ -25,6 +24,10 @@ struct PoissonError{T <: AbstractFloat} <: AbstractTuringObservationErrorModel
end
end

@doc raw"
The observation error model for Poisson errors. This function generates the
observation error model based on the Poisson error model with a positive shift.
"
function observation_error(obs_model::PoissonError, Y_t)
return Poisson(Y_t + obs_model.pos_shift)
end

0 comments on commit f030342

Please sign in to comment.