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:
- observations
stror array_like Label of the column or the float array of censored observations
- censorship
stror array_like Label of the column or the bool array of the censorship status of the observations.
True if censored,
False if uncensored
- df
DataFrame,optional If observations and censorship are labels, this is the DataFrame that contains those columns.
- min_uncensored
int,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_censored
float,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_fraction
float,optional The fraction of the detection limit to be used during simple substitution of the censored values. Default is 0.5.
- transform_in
callable,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_out
callable,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.
- observations
- Returns:
Notes
This function requires pandas 0.14 or more recent.