statsmodels.imputation.ros.impute_ros#

statsmodels.imputation.ros.impute_ros(observations, censorship, df=None, min_uncensored=2, max_fraction_censored=0.8, substitution_fraction=0.5, transform_in=<ufunc 'log'>, transform_out=<ufunc 'exp'>, as_array=True)[source]#

Impute censored dataset using Regression on Order Statistics (ROS)

Method described in Nondetects and Data Analysis by Dennis R. Helsel (John Wiley, 2005) to estimate the left-censored (non-detect) values of a dataset. When there is insufficient non-censored data, simple substitution is used.

Parameters:
observationsstr or array_like

Label of the column or the float array of censored observations

censorshipstr

Label of the column or the bool array of the censorship status of the observations.

  • True if censored,

  • False if uncensored

dfDataFrame, optional

If observations and censorship are labels, this is the DataFrame that contains those columns.

min_uncensoredint (default is 2)

The minimum number of uncensored values required before ROS can be used to impute the censored observations. When this criterion is not met, simple substitution is used instead.

max_fraction_censoredfloat (default is 0.8)

The maximum fraction of censored data below which ROS can be used to impute the censored observations. When this fraction is exceeded, simple substituion is used instead.

substitution_fractionfloat (default is 0.5)

The fraction of the detection limit to be used during simple substitution of the censored values.

transform_incallable (default is np.log)

Transformation to be applied to the values prior to fitting a line to the plotting positions vs. uncensored values.

transform_outcallable (default is np.exp)

Transformation to be applied to the imputed censored values estimated from the previously computed best-fit line.

as_arraybool (default is True)

When True, a numpy array of the imputed observations is returned. Otherwise, a modified copy of the original dataframe with all of the intermediate calculations is returned.

Returns:
imputed{ndarray, DataFrame}

The final observations where the censored values have either been imputed through ROS or substituted as a fraction of the detection limit.

Notes

This function requires pandas 0.14 or more recent.