esda.LOSH¶
-
class esda.LOSH(connectivity=
None, inference=None)[source]¶ Local spatial heteroscedasticity (LOSH)
Initialize a losh estimator
- Parameters:¶
- pval[source]¶
P-values for inference based on either “chi-square” or “permutation” methods.
- Type:¶
numpy array
Methods
fit(y[, a])Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
set_fit_request(*[, a])Configure whether metadata should be requested to be passed to the
fitmethod.set_params(**params)Set the parameters of this estimator.
-
fit(y, a=
2)[source]¶ -
Notes
Technical details and derivations can be found in [Ord and Getis, 2012].
Examples
>>> import libpysal, numpy >>> w = libpysal.io.open(libpysal.examples.get_path("stl.gal")).read() >>> f = libpysal.io.open(libpysal.examples.get_path("stl_hom.txt")) >>> y = numpy.array(f.by_col['HR8893']) >>> from esda import LOSH >>> ls = LOSH(connectivity=w, inference="chi-square").fit(y) >>> numpy.round(ls.Hi[0], 3) np.float64(0.776) >>> numpy.round(ls.pval[0], 3) np.float64(0.228)Boston housing data replicating R spdep::LOSH()
>>> import geopandas as gpd >>> boston = libpysal.examples.load_example('Bostonhsg') >>> boston_ds = gpd.read_file(boston.get_path('boston.shp')) >>> w = libpysal.weights.Queen.from_dataframe(boston_ds, use_index=False) >>> ls = LOSH(connectivity=w, inference="chi-square").fit(boston_ds['NOX']) >>> numpy.round(ls.Hi[0], 3) np.float64(0.197) >>> numpy.round(ls.VarHi[0], 3) np.float64(0.814)
- get_metadata_routing()[source]¶
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:¶
routing – A
MetadataRequestencapsulating routing information.- Return type:¶
MetadataRequest
-
set_fit_request(*, a=
'$UNCHANGED$')[source]¶ Configure whether metadata should be requested to be passed to the
fitmethod.Note that this method is only relevant when this estimator is used as a sub-estimator within a meta-estimator and metadata routing is enabled with
enable_metadata_routing=True(seesklearn.set_config()). Please check the User Guide on how the routing mechanism works.The options for each parameter are:
True: metadata is requested, and passed tofitif provided. The request is ignored if metadata is not provided.False: metadata is not requested and the meta-estimator will not pass it tofit.None: metadata is not requested, and the meta-estimator will raise an error if the user provides it.str: metadata should be passed to the meta-estimator with this given alias instead of the original name.
The default (
sklearn.utils.metadata_routing.UNCHANGED) retains the existing request. This allows you to change the request for some parameters and not others.Added in version 1.3.