esda.Moran_Rate¶
- class esda.Moran_Rate(e, b, w, adjusted=True, transformation='r', permutations=999, two_tailed=True)[source]¶
Adjusted Moran’s I Global Autocorrelation Statistic for Rate Variables [AR99]
- Parameters:
- w
W
|Graph
spatial weights instance as W or Graph aligned with e and b
variable
- transformation{‘R’, ‘B’, ‘D’, ‘U’, ‘V’}
weights transformation, default is row-standardized “r”. Other options include “B”: binary, “D”: doubly-standardized, “U”: untransformed (general weights), “V”: variance-stabilizing.
two-tailed, otherwise they are one tailed.
p_values
-
if adjusted is True, y is standardized rates
otherwise, y is raw rates
W
| Graph
original w object
Examples
>>> import libpysal
>>> w = libpysal.io.open(libpysal.examples.get_path("sids2.gal")).read()
>>> f = libpysal.io.open(libpysal.examples.get_path("sids2.dbf"))
>>> e = np.array(f.by_col('SID79'))
>>> b = np.array(f.by_col('BIR79'))
>>> from esda.moran import Moran_Rate
>>> mi = Moran_Rate(e, b, w, two_tailed=False)
>>> "%6.4f" % mi.I
'0.1662'
>>> "%6.4f" % mi.p_norm
'0.0042'
Methods
|
|
|
Function to compute a Moran_Rate statistic on a dataframe |
- classmethod by_col(df, events, populations, w=None, inplace=False, pvalue='sim', outvals=None, swapname='', **stat_kws)[source]¶
Function to compute a Moran_Rate statistic on a dataframe
- Parameters:
events are stored. If one population column is provided, it is
used for all event columns. If more than one population column
is provided but there is not a population for every event
column, an exception will be raised.
- w
W
|Graph
spatial weights instance as W or Graph aligned with the dataframe. If not provided, this is searched for in the dataframe’s metadata
return a series contaning the results of the computation. If
operating inplace, the derived columns will be named
‘column_moran_rate’
the Moran_Rate statistic’s documentation for available p-values
Moran_Rate statistic
documentation for the Moran_Rate statistic.
the
relevant
columns
attached.