Skip to content

Question/feature: perform posterior inference #83

@itsdfish

Description

@itsdfish

Hello,

I am interested in performing posterior interference with various simulation models, such as agent based models. I was wondering whether that is possible with your package. One example in Python is BayesFlow. If this is not possible currently, I think it would be a very useful feature to add.

As a simple example, suppose I have a Gaussian model and I want to update the prior on mu and sigma after observing 50 observations. Would that be possible? Here is partial code:

using Distributions 

function sample_prior()
    μ = rand(Normal(0, 1))
    σ = rand(Uniform(0, 10))
    return [μ,σ]
end

function generate_data()
    θ = sample_prior()
    y = rand(Normal(θ...))
    return [θ...,y] 
end

# rows: μ, σ, y
training_data = mapreduce(x -> generate_data(), hcat, 1:10000)

# train some data

observed_data = rand(Normal(0, 1), 50)

# obtain posterior distribution of μ and σ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions