class_docstr: Class for estimating and conducting inference in an AFT model.
  
  Parameters
  ----------
  
  endog: nx1 array
      Response variables that are subject to random censoring
  
  exog: nxk array
      Matrix of covariates
  
  censors: nx1 array
      array with entries 0 or 1.  0 indicates a response was
      censored.
  
  Attributes
  ----------
  nobs : float
      Number of observations
  endog : ndarray
      Endog attay
  exog : ndarray
      Exogenous variable matrix
  censors
      Censors array but sets the max(endog) to uncensored
  nvar : float
      Number of exogenous variables
  uncens_nobs : float
      Number of uncensored observations
  uncens_endog : ndarray
      Uncensored response variables
  uncens_exog : ndarray
      Exogenous variables of the uncensored observations
  
  Methods
  -------
  
  params:
      Fits model parameters
  
  test_beta:
      Tests if beta = b0 for any vector b0.
  
  Notes
  -----
  
  The data is immediately sorted in order of increasing endogenous
  variables
  
  The last observation is assumed to be uncensored which makes
  estimation and inference possible.
class_docstr_tok: ["Class","for","estimating","and","conducting","inference","in","an","AFT","model",".","Parameters","--","--","--","--","--","endog",":","nx1","array","Response","variables","that","are","subject","to","random","censoring","exog",":","nxk","array","Matrix","of","covariates","censors",":","nx1","array","array","with","entries","0","or","1",".","0","indicates","a","response","was","censored",".","Attributes","--","--","--","--","--","nobs",":","float","Number","of","observations","endog",":","ndarray","Endog","attay","exog",":","ndarray","Exogenous","variable","matrix","censors","Censors","array","but","sets","the","max","(","endog",")","to","uncensored","nvar",":","float","Number","of","exogenous","variables","uncens_nobs",":","float","Number","of","uncensored","observations","uncens_endog",":","ndarray","Uncensored","response","variables","uncens_exog",":","ndarray","Exogenous","variables","of","the","uncensored","observations","Methods","--","--","--","-","params",":","Fits","model","parameters","test_beta",":","Tests","if","beta","=","b0","for","any","vector","b0",".","Notes","--","--","-","The","data","is","immediately","sorted","in","order","of","increasing","endogenous","variables","The","last","observation","is","assumed","to","be","uncensored","which","makes","estimation","and","inference","possible","."]
docstr: Computes the Kaplan-Meier estimate for the weights in the AFT model
  
  Parameters
  ----------
  endog: nx1 array
      Array of response variables
  censors: nx1 array
      Censor-indicating variable
  
  Returns
  -------
  Kaplan Meier estimate for each observation
  
  Notes
  -----
  
  This function makes calls to _is_tied and km_w_ties to handle ties in
  the data.If a censored observation and an uncensored observation has
  the same value, it is assumed that the uncensored happened first.
docstr_tok: ["Computes","the","Kaplan-Meier","estimate","for","the","weights","in","the","AFT","model","Parameters","--","--","--","--","--","endog",":","nx1","array","Array","of","response","variables","censors",":","nx1","array","Censor-indicating","variable","Returns","--","--","--","-","Kaplan","Meier","estimate","for","each","observation","Notes","--","--","-","This","function","makes","calls","to","_is_tied","and","km_w_ties","to","handle","ties","in","the","data.If","a","censored","observation","and","an","uncensored","observation","has","the","same","value",",","it","is","assumed","that","the","uncensored","happened","first","."]
code: def _make_km(self, endog, censors):
      """
  
      Computes the Kaplan-Meier estimate for the weights in the AFT model
  
      Parameters
      ----------
      endog: nx1 array
          Array of response variables
      censors: nx1 array
          Censor-indicating variable
  
      Returns
      -------
      Kaplan Meier estimate for each observation
  
      Notes
      -----
  
      This function makes calls to _is_tied and km_w_ties to handle ties in
      the data.If a censored observation and an uncensored observation has
      the same value, it is assumed that the uncensored happened first.
      """
      nobs = self.nobs
      num = nobs - (np.arange(nobs) + 1.0)
      denom = nobs - (np.arange(nobs) + 1.0) + 1.0
      km = (num / denom).reshape(nobs, 1)
      km = km ** np.abs(censors - 1.0)
      km = np.cumprod(km)  # If no ties, this is kaplan-meier
      tied = self._is_tied(endog, censors)
      wtd_km = self._km_w_ties(tied, km)
      return (censors / wtd_km).reshape(nobs, 1)
  
imports: import warnings
  import numpy
  from scipy import optimize
  from scipy.stats import chi2
  from statsmodels.regression.linear_model import OLS, WLS
  from statsmodels.tools import add_constant
  from statsmodels.tools.sm_exceptions import IterationLimitWarning
  from .descriptive import _OptFuncts
label_desc: Use image node_id 4 for calling the emplikeAFT obj's underlying member method code with example usage: obj._make_km(endog, censors) and returns: unknown