ineqpy.statistics
Descriptive statistics.
This module contains main descriptive statistics like: mean, variance, etc.
Module Contents
Functions
|
Calculate central momment. |
|
Calculate the value of a quantile given a variable and his weights. |
|
Calculate standarized momment. |
|
Calculate the mean of variable given weights. |
|
Density in percentage. |
|
Calculate the variance. |
|
Calculate the coefficient of variation. |
|
Calculate the Kurtosis coefficient. |
|
Return the asymmetry coefficient of a sample. |
- ineqpy.statistics.c_moment(variable=None, weights=None, data=None, order=2, param=None, ddof=0)[source]
Calculate central momment.
Calculate the central moment of x with respect to param of order n, given the weights w.
- Parameters:
- variable1d-array
Variable
- weights1d-array
Weights
- datapandas.DataFrame
Contains all variables needed.
- orderint, optional
Moment order, 2 by default (variance)
- paramint or array, optional
Parameter for which the moment is calculated, the default is None, implies use the mean.
- ddofint, optional
Degree of freedom, zero by default.
- Returns:
- central_momentfloat
Notes
The cmoment of order 1 is 0
The cmoment of order 2 is the variance.
- ineqpy.statistics.percentile(variable=None, weights=None, data=None, p=50, interpolate='lower')[source]
Calculate the value of a quantile given a variable and his weights.
- Parameters:
- variablestr or array
- weightsstr or array
- datapd.DataFrame, optional
pd.DataFrame that contains all variables needed.
- qfloat
Quantile level, if pass 0.5 means median.
- interpolatebool
- Returns:
- percentilefloat or pd.Series
- ineqpy.statistics.std_moment(variable=None, weights=None, data=None, param=None, order=3, ddof=0)[source]
Calculate standarized momment.
Calculate the standardized moment of order c for the variable` x` with respect to c.
- Parameters:
- variable1d-array
Random Variable
- weights1d-array, optional
Weights or probability
- datapd.DataFrame, optional
pd.DataFrame that contains all variables needed.
- orderint, optional
Order of Moment, three by default
- paramint or float or array, optional
Central trend, default is the mean.
- ddofint, optional
Degree of freedom.
- Returns:
- std_momentfloat
Returns the standardized n order moment.
References
- ineqpy.statistics.mean(variable=None, weights=None, data=None)[source]
Calculate the mean of variable given weights.
- Parameters:
- variablearray-like or str
Variable on which the mean is estimated.
- weightsarray-like or str
Weights of the x variable.
- datapandas.DataFrame
Is possible pass a DataFrame with variable and weights, then you must pass as variable and weights the column name stored in data.
- Returns:
- meanarray-like or float
- ineqpy.statistics.density(variable=None, weights=None, groups=None, data=None)[source]
Density in percentage.
Calculates density in percentage. This make division of variable inferring width in groups as max - min.
- Parameters:
- variablenumpy.array or pandas.DataFrame
Main variable.
- weightsnumpy.array or pandas.DataFrame
Weights of main variable.
- groupsnumpy.array or pandas.DataFrame
Label that show which group each element belongs to.
- datapd.DataFrame, optional
Object that contains all variables needed.
- Returns:
- densityarray-like
References
Histogram. (2017, May 9). In Wikipedia, The Free Encyclopedia. Retrieved 14:47, May 15, 2017, from https://en.wikipedia.org/w/index.php?title=Histogram&oldid=779516918
- ineqpy.statistics.var(variable=None, weights=None, data=None, ddof=0)[source]
Calculate the variance.
Calculate the population variance of variable given weights.
- Parameters:
- datapd.DataFrame, optional
pd.DataFrame that contains all variables needed.
- variable1d-array or pd.Series or pd.DataFrame
Variable on which the quasivariation is estimated
- weights1d-array or pd.Series or pd.DataFrame
Weights of the variable.
- datapd.DataFrame
Object that contains all variables needed.
- ddofint
Degree of freedom.
- Returns:
- variance1d-array or pd.Series or float
Estimation of quasivariance of variable
Notes
If stratificated sample must pass with groupby each strata.
References
Moment (mathematics). (2017, May 6). In Wikipedia, The Free Encyclopedia. Retrieved 14:40, May 15, 2017, from https://en.wikipedia.org/w/index.php?title=Moment_(mathematics)
- ineqpy.statistics.coef_variation(variable=None, weights=None, data=None)[source]
Calculate the coefficient of variation.
Calculate the coefficient of variation of a variable given weights. The coefficient of variation is the square root of the variance of the incomes divided by the mean income. It has the advantages of being mathematically tractable and is subgroup decomposable, but is not bounded from above.
- Parameters:
- variablearray-like or str
- weightsarray-like or str
- datapandas.DataFrame
- Returns:
- coefficient_variationfloat
References
Coefficient of variation. (2017, May 5). In Wikipedia, The Free Encyclopedia. Retrieved 15:03, May 15, 2017, from https://en.wikipedia.org/w/index.php?title=Coefficient_of_variation
- ineqpy.statistics.kurt(variable=None, weights=None, data=None)[source]
Calculate the Kurtosis coefficient.
- Parameters:
- variable1d-array
- weights1d-array
- datapandas.DataFrame
Object which stores
variable
andweights
.
- Returns:
- kurtfloat
Kurtosis coefficient.
Notes
It is an alias of the standardized fourth-order moment.
References
Moment (mathematics). (2017, May 6). In Wikipedia, The Free Encyclopedia. Retrieved 14:40, May 15, 2017, from https://en.wikipedia.org/w/index.php?title=Moment_(mathematics)
- ineqpy.statistics.skew(variable=None, weights=None, data=None)[source]
Return the asymmetry coefficient of a sample.
- Parameters:
- datapandas.DataFrame
- variablearray-like, str
- weightsarray-like, str
- datapandas.DataFrame
Object which stores
variable
andweights
.
- Returns:
- skewfloat
Notes
It is an alias of the standardized third-order moment.
References
Moment (mathematics). (2017, May 6). In Wikipedia, The Free Encyclopedia. Retrieved 14:40, May 15, 2017, from https://en.wikipedia.org/w/index.php?title=Moment_(mathematics)