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
str 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(defaultis2) 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_censored
float(defaultis0.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_fraction
float(defaultis0.5) The fraction of the detection limit to be used during simple substitution of the censored values.
- transform_in
callable(defaultisnp.log) Transformation to be applied to the values prior to fitting a line to the plotting positions vs. uncensored values.
- transform_out
callable(defaultisnp.exp) Transformation to be applied to the imputed censored values estimated from the previously computed best-fit line.
- as_arraybool (
defaultisTrue) 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.
- observations
- Returns:
Notes
This function requires pandas 0.14 or more recent.