neighbayes.models.Level¶
-
class neighbayes.models.Level(formula=
None, data=None, *, y=None, X=None, W=None, process='SAR', key=None, groups=None, name=None)[source]¶ One level’s equation for
Multilevel.- Parameters:¶
- formula : str, optional¶
At the units,
"y ~ x1 + x2". Above them, the level’s covariates,"~ z1 + z2"; the intercept is dropped (the units carry the only one).Noneor"~ 1"means no covariates.- data : DataFrame, optional¶
The level’s rows. At the units, the data the formula reads. Above, one row per group, matched to the groups by
key(or the index).- y : array-like, optional¶
Matrix mode in place of
formula/data(yat the units only).- X : array-like, optional¶
Matrix mode in place of
formula/data(yat the units only).- W : libpysal.graph.Graph or scipy.sparse matrix¶
The level’s graph over all its groups, regardless of parent. Optional when
process=None.- process : {"SAR", "SEM", "SDM", "SDEM", "SLX", None}, default "SAR"¶
The level’s spatial process; the Durbin processes add the spatial lags of the level’s covariates,
W_ℓ X_ℓ.Noneis aspatial.- key : str, optional¶
The id column shared with the level below: each lower row’s value names its group here. Looked up in the level below’s data, then in the units’ data (strict nesting is checked).
- groups : array-like, optional¶
Matrix mode in place of
key: one group label per row of the level below.- name : str, optional¶
A label for summaries; defaults to
key.
Notes
The groups are ordered by the Graph’s ids when
Wis a Graph (the level’s data are reindexed to them); otherwise by the rows ofdata, or by the sorted labels when there are no data. A sparseWmust follow that order.-
__init__(formula=
None, data=None, *, y=None, X=None, W=None, process='SAR', key=None, groups=None, name=None)[source]¶
Methods
__init__([formula, data, y, X, W, process, ...])Attributes