Skip to content

Commit 0fee831

Browse files
committed
chase down partial arg changes
1 parent 939ca74 commit 0fee831

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

EpiAware/src/EpiLatentModels/models/HierarchicalNormal.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ rand(mdl)
3030
mean::R = 0.0
3131
std_prior::D = truncated(Normal(0, 1), 0, Inf)
3232

33-
function HierarchicalNormal(std_prior::D)
33+
function HierarchicalNormal(std_prior::Sampleable)
3434
return HierarchicalNormal(; mean = 0.0, std_prior = std_prior)
3535
end
3636
end

EpiAware/src/EpiLatentModels/models/MA.jl

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ The moving average (MA) model struct.
44
# Constructors
55
- `MA(θ::Distribution, σ::Distribution; q::Int = 1, ϵ::AbstractTuringLatentModel = IDD(Normal()))`: Constructs an MA model with the specified prior distributions.
66
7-
- `MA(; θ::Vector{C} = [truncated(Normal(0.0, 0.05), -1, 1)], σ::Distribution = HalfNormal(0.1), ϵ::AbstractTuringLatentModel = HierarchicalNormal) where {C <: Distribution}`: Constructs an MA model with the specified prior distributions.
7+
- `MA(; θ::Vector{C} = [truncated(Normal(0.0, 0.05), -1, 1)], ϵ::AbstractTuringLatentModel = HierarchicalNormal) where {C <: Distribution}`: Constructs an MA model with the specified prior distributions.
88
99
- `MA(θ::Distribution, q::Int, ϵ_t::AbstractTuringLatentModel)`: Constructs an MA model with the specified prior distributions and order.
1010
1111
# Parameters
1212
- `θ`: Prior distribution for the MA coefficients. For MA(q), this should be a vector of q distributions or a multivariate distribution of dimension q.
1313
- `q`: Order of the MA model, i.e., the number of lagged error terms.
14-
- `ϵ_t`: Distribution of the error term, typically standard normal.
14+
- `ϵ_t`: Distribution of the error term, typically standard normal. Defaults to `IDD(Normal())`.
1515
1616
# Examples
1717
@@ -44,26 +44,24 @@ struct MA{C <: Sampleable, S <: Sampleable, Q <: Int, E <: AbstractTuringLatentM
4444
"Prior distribution for the error term."
4545
ϵ_t::E
4646

47-
function MA::Distribution, σ::Distribution;
48-
q::Int = 1, ϵ::AbstractTuringLatentModel = IDD(Normal()))
47+
function MA::Distribution;
48+
q::Int = 1, ϵ_t::AbstractTuringLatentModel = HierarchicalNormal(HalfNormal(0.1)))
4949
θ_priors = fill(θ, q)
50-
return MA(; θ_priors = θ_priors, σ = σ, ϵ = ϵ)
50+
return MA(; θ_priors = θ_priors, ϵ_t = ϵ_t)
5151
end
5252

5353
function MA(; θ_priors::Vector{C} = [truncated(Normal(0.0, 0.05), -1, 1)],
54-
σ::Distribution = HalfNormal(0.1),
55-
ϵ::AbstractTuringLatentModel = IDD(Normal())) where {C <: Distribution}
54+
ϵ_t::AbstractTuringLatentModel = HierarchicalNormal(HalfNormal(0.1))) where {C <:
55+
Distribution}
5656
q = length(θ_priors)
5757
θ = _expand_dist(θ_priors)
58-
return MA(θ, q, ϵ)
58+
return MA(θ, q, ϵ_t)
5959
end
6060

61-
function MA::Distribution, q::Int, ϵ::AbstractTuringLatentModel)
61+
function MA::Distribution, q::Int, ϵ_t::AbstractTuringLatentModel)
6262
@assert q>0 "q must be greater than 0"
6363
@assert q==length(θ) "q must be equal to the length of θ"
64-
new{typeof(θ), typeof(σ), typeof(q), typeof(ϵ)}(
65-
θ, q, ϵ
66-
)
64+
new{typeof(θ), typeof(q), typeof(ϵ_t)}(θ, q, ϵ_t)
6765
end
6866
end
6967

@@ -85,7 +83,7 @@ Generate a latent MA series.
8583
q = latent_model.q
8684
@assert n>q "n must be longer than order of the moving average process"
8785
θ ~ latent_model.θ
88-
@submodel ϵ_t = generate_latent(latent_model.ϵ, n)
86+
@submodel ϵ_t = generate_latent(latent_model.ϵ_t, n)
8987

9088
ma = accumulate_scan(
9189
MAStep(θ),

0 commit comments

Comments
 (0)