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
using CSV, DataFrames, Econometrics, GLM, Statistics, TableView | |
# Read in the data - unbalanced panel | |
# Data from https://rdrr.io/cran/panelvar/man/abdata.html | |
df = CSV.read("abdata.csv", copycols = true) | |
# We start by estimating standard OLS on our data, running the model | |
# | |
# yᵢₜ = α₁Lyᵢₜ + α₂L²yᵢₜ + β₁wᵢₜ + β₂Lwᵢₜ + β₃kᵢₜ + β₄Lkᵢₜ + β₅L²kᵢₜ + β₆ysᵢₜ + β₇Lysᵢₜ + β₈L²ysᵢₜ | |
# + ∑yearₜ |
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!(Base.DEPOT_PATH) | |
push!(Base.DEPOT_PATH, joinpath(@__DIR__, "depot")) | |
using Pkg | |
Pkg.update() | |
registry_dir = joinpath(@__DIR__, "depot", "registries", "General") | |
regdict = Pkg.Types.read_registry(joinpath(registry_dir, "Registry.toml"))["packages"] | |
ctx = Pkg.Types.Context() | |
all_pkgspecs = Pkg.Types.PackageSpec[] |
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
function sankey!(target, x1, x2, bend, start_min, start_max, stop_min, stop_max, color_start, color_stop) | |
bezier(t, p1, p2, p3, p4) = (1 - t)^3 * p1 + 3(1 - t)^2 * t * p2 + 3 * (1 - t) * t^2 * p3 + t^3 * p4 | |
b(t, start, stop) = begin | |
p_start = Point2f(x1, start) | |
p_stop = Point2f(x2, stop) | |
c1 = Point2f(x1 + bend * (x2-x1), start) | |
c2 = Point2f(x2 - bend * (x2-x1), stop) | |
bezier(t, p_start, c1, c2, p_stop) | |
end |