9  TX: School-Level Overall Achievement

Code
state = 'tx'
Code
schools = gpd.read_parquet(f"../data/{state}_schools.parquet")
schools = schools.to_crs(schools.estimate_utm_crs())
schools = schools.dropna(subset=['avg_score', 'learning_rate', 'learning_trend'])
Code
schools.avg_score.describe()
count    4338.000000
mean       -0.178465
std         1.118447
min        -2.977751
25%        -0.960261
50%        -0.317185
75%         0.437322
max         5.222785
Name: avg_score, dtype: float64
Code
schools.avg_score.hist()

But the distribution of achievement is not geographically even, which can be seen by plotting the average achievement score as a choropleth map, where each school is colored according to its score

Code
schools.explore(
    "avg_score",
    scheme="quantiles",
    k=8,
    cmap="PRGn",
    tiles="Stamen Toner Lite",
    marker_kwds={"radius": 7},
    tooltip=["NAME", "avg_score"],
)
Make this Notebook Trusted to load map: File -> Trust Notebook

9.1 Exporatory Spatial Data Analysis - “Global” Scale

Code
w_school = weights.KNN.from_dataframe(schools, k=8)
moran = esda.Moran(schools.avg_score.values, w_school, permutations=99999)

print(f"School-level Moran's I coefficient: {np.round(moran.I,3)}")

print(f"p-value of Moran's I: {np.round(moran.p_sim, 5)}")
School-level Moran's I coefficient: 0.551
p-value of Moran's I: 1e-05
Code
esplt.plot_moran(moran)
(<Figure size 1000x400 with 2 Axes>,
 array([<AxesSubplot:title={'center':'Reference Distribution'}, xlabel='Moran I: 0.55', ylabel='Density'>,
        <AxesSubplot:title={'center':'Moran Scatterplot (0.55)'}, xlabel='Attribute', ylabel='Spatial Lag'>],
       dtype=object))

9.2 Exporatory Spatial Data Analysis - “Local” Scale

9.2.1 Average Achievement

Code
lisa_school_avg = esda.Moran_Local(schools.dropna(subset=['avg_score']).avg_score.values, w_school)

esplt.plot_local_autocorrelation(lisa_school_avg, schools, 'avg_score')
(<Figure size 1500x400 with 3 Axes>,
 array([<AxesSubplot:title={'center':'Moran Local Scatterplot'}, xlabel='Attribute', ylabel='Spatial Lag'>,
        <AxesSubplot:>, <AxesSubplot:>], dtype=object))

Code
explore_local_moran(
    lisa_school_avg,
    schools,
    "avg_score",
    crit_value=0.01,
    explore_kwargs={
        "marker_kwds": {"radius": 7},
        "tooltip": ["NAME", "avg_score"],
        "tiles": "Stamen Toner Lite",
    },
)
Make this Notebook Trusted to load map: File -> Trust Notebook

There are several obvious and remarkable trends in a few large cities. In Austin, the East-West divide is prevalent, with the west side of the city having higher scores. In Houston there is a strong city vs suburb dynamic apparent, with a few coldspots downtown and several hotpots circling the periphery. San Antonio has both directional and centrifugal patterns where a north-south divide is present as well as a city/suburb divide. Here, the northern suburbs are the places with much higher scores.

9.2.2 Achievement Trend

Repeating the analysis for trends in school-level achievement reveals many of the same patterns, however in this case the value for Moran’s I is much lower.

Code
lisa_school_trend = esda.Moran_Local(schools.dropna(subset=['learning_trend']).learning_trend.values, w_school)
Code
explore_local_moran(
    lisa_school_trend,
    schools,
    "avg_score",
    crit_value=0.01,
    explore_kwargs={
        "marker_kwds": {"radius": 7},
        "tooltip": ["NAME", "avg_score"],
        "tiles": "Stamen Toner Lite",
    },
)
Make this Notebook Trusted to load map: File -> Trust Notebook