API Reference
ring_model.build_land_value! — Methodbuild_land_value!(df::DataFrame, M::MPSGEModel, labor_endowment::Int; regions = regions)Builds and appends land value data to the provided DataFrame.
Returns
A DataFrame with columns given by regions, land_value, distance, labor_endowment, and normalized_land_value.
ring_model.initialize_data — Methodinitialize_data(N::Int; random_seed = 1234)Initializes the data for the model. The data returns of the following:
regions: A vector of symbols representing the regions in the model.goods: A vector of symbols representing the goods in the model.starting_land_share: A NamedArray with the initial land share for each good.weight: A NamedArray with the weight of each good in the utility function.
Arguments
N::Int: The number of regions in the model.
Keyword Arguments
random_seed::Int = 1234: The random seed to use for the random number generator.
Example
To create data for 3 regions:
(regions, goods, starting_land_share, weight) = initialize_data(3)ring_model.ring_animation — Methodring_animation(land_value::DataFrame; file_name = "example.html")Creates an animated plot of the ring model land value data. Outputs an HTML file with the animation.
Arguments
land_value::DataFrame: The DataFrame containing land value data.file_name::String: The name of the file to save the animation. Default is "example.html".
ring_model.ring_data — Methodring_data(number_regions::Int; labor_endowment_range = 10_000:10_000:1_000_000)Compute the land value data for the ring model with a specified number of regions and a range of labor endowments.
Arguments
number_regions::Int: The number of regions in the model.labor_endowment_range::UnitRange{Int}: The range of labor endowments to compute land values for. Default is10_000:10_000:1_000_000.
Returns
A land value DataFrame generated using build_land_value! for each labor endowment in the specified range.
ring_model.ring_mcp — Methodring_mcp(
regions,
goods,
starting_land_share,
weight;
initial_labor_endowment = 5000
)Constructs an MCP model of a ring economy.
ring_model.ring_mpsge — Methodring_mpsge(
regions,
goods,
starting_land_share,
weight;
initial_labor_endowment = 5000
)Constructs an MPSGE model of a ring economy.
ring_model.ring_plot — Methodring_plot(land_value::DataFrame; y = :normalized_land_value)Creates a plot of the ring model land value data.
Arguments
land_value::DataFrame: The DataFrame containing land value data.y::Symbol: The column to plot on the y-axis. Default is:normalized_land_value.
Returns
A list of traces to plot.
Example
```julia df = ring_data(5)
plot(createringplot(df))
ring_model.ring_plot_button — Methodring_plot_button(df::DataFrame)Creates a plot with buttons to toggle between normalized land value and land value.
Arguments
df::DataFrame: The DataFrame containing land value data.
Returns
A PlotlyJS plot with buttons to toggle between normalized land value and land value.