linearmodels.panel.data.PanelData.demean

PanelData.demean(group: 'entity' | 'time' | 'both', *, return_panel: False) ndarray[source]
PanelData.demean(group: 'entity' | 'time' | 'both' = 'entity', weights: PanelData | None = None, return_panel: True = True, low_memory: bool = False) PanelData
PanelData.demean(group: 'entity' | 'time' | 'both', weights: PanelData | None, return_panel: False) ndarray

Demeans data by either entity or time group

Parameters:
group: 'entity' | 'time' | 'both'
group: 'entity' | 'time' | 'both' = 'entity'

Group to use in demeaning

weights: PanelData | None = None
weights: PanelData | None

Weights to implement weighted averaging

return_panel: False
return_panel: True = True

Flag indicating to return a PanelData object. If False, a 2-d NumPy representation of the panel is returned

low_memory: bool = False

Flag indicating whether to use a low memory implementation that avoids constructing dummy variables. Only relevant when group is “both”

Returns:

Demeaned data according to type

Return type:

linearmodels.panel.data.PanelData

Notes

If weights are provided, the values returned will be scaled by the square root of the weights so that they can be used in WLS estimation.