geosnap.analyze.draw_sequence_from_gdf

geosnap.analyze.draw_sequence_from_gdf(gdf, w, label_column, smk, time_column, start_time=None, time_steps=1, increment=None, seed=None)[source]

Draw a set of class labels for each unit in a geodataframe using transition probabilities defined by a giddy.Spatial_Markov model and the spatial lag of each unit.

Parameters:
gdfgeopandas.GeoDataFrame

geodataframe of observations with class/cluster labels as a column

wlibpysal.weights.W

spatial weights object that defines the neigbhbor graph for each unit.

label_columnstr

the column on the dataframe that holds class labels

smkgiddy.Spatial_Markov

an instance of a Spatial_Markov class created from the giddy package or geosnap.analyze.transition

time_columnstr

column on dataframe that identifies unique time periods, by default “year”

start_timestr, int, or float, optional

Time period to begin drawing a sequence of labels (must be present in gdf[label_col]). If None, use the most recent time period given by max(gdf[label_column].unique()). By default None

time_stepsint, optional

the number of time-steps to simulate (i.e. the number of labels to draw in a sequence for each unit), by default 1

incrementitn, required

styled increment each time-step referrs to. For example, for a model fitted to decadal Census data, each time-step refers to a period of ten years, so an increment of 10 ensures that the temporal index aligns appropriately with the time steps being simulated

seed: int

seed for reproducible pseudo-random results. Used to create a SeedSequence and spawn a set of Generators using PCG64. If None, uses the current time

Returns:
geopandas.GeoDataFrame

long-form geodataframe with the same index as the geodataframe in the time period equal the start time (i.e. gdf[gdf[time_column]==start_time]).