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 or array_like

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, optional

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. Default is 2.

max_fraction_censoredfloat, optional

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. Default is 0.8.

substitution_fractionfloat, optional

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

transform_incallable, optional

Transformation to be applied to the values prior to fitting a line to the plotting positions vs. uncensored values. Default is np.log.

transform_outcallable, optional

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

as_arraybool, optional

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. Default is True.

Returns:
imputedndarray or 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.