tobler.model.glm_pixel_adjusted

tobler.model.glm_pixel_adjusted(source_df=None, target_df=None, raster='nlcd_2011', raster_codes=None, variable=None, formula=None, likelihood='poisson', force_crs_match=True, **kwargs)[source]

Estimate interpolated values using raster data as input to a generalized linear model, then apply an adjustmnent factor based on pixel values.

Unlike the regular glm function, this version applies an experimental pixel-level adjustment subsequent to fitting the model. This has the benefit of making sure local control totals are respected, but can also induce unknown error. Use with caution.

Parameters
source_dfgeopandas.GeoDataFrame, required

geodataframe containing source original data to be represented by another geometry

target_dfgeopandas.GeoDataFrame, required

geodataframe containing target boundaries that will be used to represent the source data

rasterstr, required (default=”nlcd_2011”)

path to raster file that will be used to input data to the regression model. i.e. a coefficients refer to the relationship between pixel counts and population counts. Defaults to 2011 NLCD

raster_codeslist, required (default =[21, 22, 23, 24])

list of integers that represent different types of raster cells. Defaults to [21, 22, 23, 24] whichare considered developed land types in the NLCD

variablestr, required

name of the variable (column) to be modeled from the source_df

formulastr, optional

patsy-style model formula

likelihoodstr, {‘poisson’, ‘gaussian’} (default = “poisson”)

the likelihood function used in the model

Returns
interpolatedgeopandas.GeoDataFrame

a new geopandas dataframe with boundaries from target_df and modeled attribute data from the source_df