diff --git a/EpiAware/src/EpiLatentModels/EpiLatentModels.jl b/EpiAware/src/EpiLatentModels/EpiLatentModels.jl index 1cff8d8be..1dabab681 100644 --- a/EpiAware/src/EpiLatentModels/EpiLatentModels.jl +++ b/EpiAware/src/EpiLatentModels/EpiLatentModels.jl @@ -15,7 +15,7 @@ using Turing, Distributions, DocStringExtensions, LinearAlgebra, SparseArrays, OrdinaryDiffEq #Export models -export FixedIntercept, Intercept, RandomWalk, AR, HierarchicalNormal +export FixedIntercept, Intercept, RandomWalk, AR, HierarchicalNormal, Null #Export ODE definitions export SIRParams, SEIRParams @@ -38,6 +38,7 @@ include("models/Intercept.jl") include("models/RandomWalk.jl") include("models/AR.jl") include("models/HierarchicalNormal.jl") +include("models/Null.jl") include("odemodels/SIRParams.jl") include("odemodels/SEIRParams.jl") include("modifiers/DiffLatentModel.jl") diff --git a/EpiAware/src/EpiLatentModels/models/Null.jl b/EpiAware/src/EpiLatentModels/models/Null.jl new file mode 100644 index 000000000..064d43320 --- /dev/null +++ b/EpiAware/src/EpiLatentModels/models/Null.jl @@ -0,0 +1,24 @@ +@doc raw" +A null model struct. This struct is used to indicate that no latent variables are to be generated. +" +struct Null <: AbstractTuringLatentModel end + +@doc raw" +Generates `nothing` as latent variables for the given `latent_model` of type `Null`. + +# Example +```jldoctest +using EpiAware +null = Null() +null_mdl = generate_latent(null, 10) +isnothing(null_mdl()) + +# output + +true + +``` +" +@model function EpiAwareBase.generate_latent(latent_model::Null, n) + return nothing +end diff --git a/EpiAware/test/EpiLatentModels/models/Null.jl b/EpiAware/test/EpiLatentModels/models/Null.jl new file mode 100644 index 000000000..305760702 --- /dev/null +++ b/EpiAware/test/EpiLatentModels/models/Null.jl @@ -0,0 +1,8 @@ +@testitem "Null Model Tests" begin + # Test that Null can be instantiated + @test Null() isa Null + + # Test that generate_latent returns nothing + null = Null() + @test isnothing(generate_latent(null, 10)()) +end