-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
posteriori data generation and structures defined
- Loading branch information
Piotr Chlebicki
committed
May 16, 2024
1 parent
2b8e19d
commit 737509a
Showing
8 changed files
with
181 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,42 @@ | ||
module UnobservedCountEstimation | ||
|
||
# Write your package code here. | ||
|
||
# Imports | ||
using Optim | ||
using Statistics | ||
using GLM | ||
using Distributions | ||
using Copulas | ||
using DataFrames | ||
using Integrals, FastGaussQuadrature | ||
using SpecialFunctions | ||
using Distributions | ||
using FastGaussQuadrature | ||
using GLM | ||
using Integrals | ||
using LinearAlgebra | ||
using Copulas | ||
using Optim | ||
using ProgressMeter | ||
using SpecialFunctions | ||
using Statistics | ||
# TODO:: StatsBase.jl compatibility | ||
# TODO:: Turing.jl compatibility | ||
|
||
include("zhang_likelihood.jl") | ||
include("original_model.jl") | ||
|
||
include("binomial_model_sampling_no_random_effect.jl") | ||
include("binomial_model_sampling_random_effect.jl") | ||
include("binomial_model.jl") | ||
include("struct.jl") | ||
|
||
include("interface.jl") | ||
|
||
export placeholder | ||
export zhang_model | ||
export binomial_model | ||
export | ||
# functions | ||
zhang_model, | ||
binomial_model, | ||
placeholder, | ||
posterior_data_generation | ||
|
||
# Concrete types | ||
ZhangUnobservedCountModel, | ||
BayesianUnobservedCountModel, | ||
|
||
# Abstract supertype | ||
AbstractUnobservedCountModel | ||
|
||
end | ||
end # end module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function posterior_data_generation(object::ZhangUnobservedCountModel) | ||
"foo" | ||
end | ||
|
||
|
||
# MAP or Mean | ||
function posterior_data_generation(object::BayesianUnobservedCountModel; est = "MAP", rep = 500) | ||
par = object.coefs[est] | ||
Q = length.(object.:data)[1] | ||
|
||
M = par[1:Q] | ||
γ₁ = par[end - 1] | ||
γ₂ = par[end] | ||
u = 1 | ||
if length(par) != Q + 2 | ||
u = par[(Q + 1):(end - 2)] | ||
end # end if | ||
μ = (object.data[3] .^ γ₁) .* ((object.data[2] ./ object.data[3]) .^ γ₂) | ||
μ = 1 ./ (1 .+ 1 ./ μ) | ||
|
||
rand.(Binomial.(M, u .* μ), rep) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# TODO:: rename after deciding on type name | ||
|
||
abstract type | ||
AbstractUnobservedCountModel | ||
end | ||
|
||
|
||
mutable struct ZhangUnobservedCountModel <: AbstractUnobservedCountModel | ||
coefs | ||
optim_result | ||
end | ||
|
||
|
||
mutable struct BayesianUnobservedCountModel <: AbstractUnobservedCountModel | ||
sim_res | ||
data | ||
coefs | ||
prior | ||
iter::Int | ||
Q::Int | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters