How to determine distribution of real-world data and then apply same distribution to model with Agents.jl

tfranks
Thu, 19 Sep 2024 18:52:26 +0000
Modelling & Simulations

Hello,

Goal: trying to determine distribution from 4Q22 data set and apply the same distribution to a network model using Agents.jl. See 4Q22 data on xy-grid.

Background: I had an earlier post on Discourse where I guessed that the distribution was Poisson, but the data are not normally distributed. See actual grid of data below,

Latest attempt: I used the “fit” function in Distributions.jl to get the following info on the 4Q22 data.
Gamma result: Gamma{Float64}(α=14.01547510539733, θ=6.195715980420822)
Exponential result: Exponential{Float64}(θ=86.83590308370044)
Poisson result: Poisson{Float64}(λ=86.83590308370044)

Gamma seems the best option, but still looks normally distributed. See xy, xyz grids and code below. Should I take a different approach? Am I misunderstanding or misapplying the results from “fit”?

Thank you. Best.

Blockquote##Gamma distribution for x and y coordinates
xes = rand(Gamma(14), n_banks)
yes = rand(Gamma(6), n_banks)

#=
##Erlang distribution for x and y coordinates
shape = 7
xrate = .5
yrate = 1.0
uninsured_values = rand(Erlang(shape, xrate), n_banks)
investments_values = rand(Erlang(shape, yrate), n_banks)
=#

#add Bank agents;
#for i in 1:n_banks
for (x, y) in zip(xes, yes)    #Poisson
    add_agent!(Bank, model,
    #pos=(x,y),      #Poisson
    pos=(round(Int, x), round(Int, y)),    #Gamma
    #uninsured = uninsured_values[i],
    #investments = investments_values[i],
    uninsured = rand(),        #Poisson
    investments = 2 * rand(),    #Poisson
    totDep = 100,
    AFS_securities = rand(1:10),
    social_network = rand(1:3),
    vul = false,
    health = true,
    acolor = :black,
    interest_rate = rand(1:10),
    )
end

7 posts - 2 participants