class_docstr: Cox Proportional Hazards Regression Model
  
  The Cox PH Model is for right censored data.
  
  Parameters
  ----------
  endog : array_like
      The observed times (event or censoring)
  exog : 2D array_like
      The covariates or exogeneous variables
  status : array_like
      The censoring status values; status=1 indicates that an
      event occurred (e.g. failure or death), status=0 indicates
      that the observation was right censored. If None, defaults
      to status=1 for all cases.
  entry : array_like
      The entry times, if left truncation occurs
  strata : array_like
      Stratum labels.  If None, all observations are taken to be
      in a single stratum.
  ties : str
      The method used to handle tied times, must be either 'breslow'
      or 'efron'.
  offset : array_like
      Array of offset values
  missing : str
      The method used to handle missing data
  
  Notes
  -----
  Proportional hazards regression models should not include an
  explicit or implicit intercept.  The effect of an intercept is
  not identified using the partial likelihood approach.
  
  `endog`, `event`, `strata`, `entry`, and the first dimension
  of `exog` all must have the same length
class_docstr_tok: ["Cox","Proportional","Hazards","Regression","Model","The","Cox","PH","Model","is","for","right","censored","data",".","Parameters","--","--","--","--","--","endog",":","array_like","The","observed","times","(","event","or","censoring",")","exog",":","2D","array_like","The","covariates","or","exogeneous","variables","status",":","array_like","The","censoring","status","values",";","status=1","indicates","that","an","event","occurred","(","e.g",".","failure","or","death",")",",","status=0","indicates","that","the","observation","was","right","censored",".","If","None",",","defaults","to","status=1","for","all","cases",".","entry",":","array_like","The","entry","times",",","if","left","truncation","occurs","strata",":","array_like","Stratum","labels",".","If","None",",","all","observations","are","taken","to","be","in","a","single","stratum",".","ties",":","str","The","method","used","to","handle","tied","times",",","must","be","either","'breslow'","or","'efron","'",".","offset",":","array_like","Array","of","offset","values","missing",":","str","The","method","used","to","handle","missing","data","Notes","--","--","-","Proportional","hazards","regression","models","should","not","include","an","explicit","or","implicit","intercept",".","The","effect","of","an","intercept","is","not","identified","using","the","partial","likelihood","approach",".","`","endog","`",",","`","event","`",",","`","strata","`",",","`","entry","`",",","and","the","first","dimension","of","`","exog","`","all","must","have","the","same","length"]
code: def predict(
      self,
      params,
      exog=None,
      cov_params=None,
      endog=None,
      strata=None,
      offset=None,
      pred_type="lhr",
      pred_only=False,
  ):
      # This function breaks mediation, because it does not simply
      # return the predicted values as an array.
  
      pred_type = pred_type.lower()
      if pred_type not in ["lhr", "hr", "surv", "cumhaz"]:
          msg = "Type %s not allowed for prediction" % pred_type
          raise ValueError(msg)
  
      class bunch:
          predicted_values = None
          standard_errors = None
  
      ret_val = bunch()
  
      # Do not do anything with offset here because we want to allow
      # different offsets to be specified even if exog is the model
      # exog.
      exog_provided = True
      if exog is None:
          exog = self.exog
          exog_provided = False
  
      lhr = np.dot(exog, params)
      if offset is not None:
          lhr += offset
      # Never use self.offset unless we are also using self.exog
      elif self.offset is not None and not exog_provided:
          lhr += self.offset
  
      # Handle lhr and hr prediction first, since they do not make
      # use of the hazard function.
  
      if pred_type == "lhr":
          ret_val.predicted_values = lhr
          if cov_params is not None:
              mat = np.dot(exog, cov_params)
              va = (mat * exog).sum(1)
              ret_val.standard_errors = np.sqrt(va)
          if pred_only:
              return ret_val.predicted_values
          return ret_val
  
      hr = np.exp(lhr)
  
      if pred_type == "hr":
          ret_val.predicted_values = hr
          if pred_only:
              return ret_val.predicted_values
          return ret_val
  
      # Makes sure endog is defined
      if endog is None and exog_provided:
          msg = "If `exog` is provided `endog` must be provided."
          raise ValueError(msg)
      # Use model endog if using model exog
      elif endog is None and not exog_provided:
          endog = self.endog
  
      # Make sure strata is defined
      if strata is None:
          if exog_provided and self.surv.nstrat > 1:
              raise ValueError("`strata` must be provided")
          if self.strata is None:
              strata = [
                  self.surv.stratum_names[0],
              ] * len(endog)
          else:
              strata = self.strata
  
      cumhaz = np.nan * np.ones(len(endog), dtype=np.float64)
      stv = np.unique(strata)
      bhaz = self.baseline_cumulative_hazard_function(params)
      for stx in stv:
          ix = np.flatnonzero(strata == stx)
          func = bhaz[stx]
          cumhaz[ix] = func(endog[ix]) * hr[ix]
  
      if pred_type == "cumhaz":
          ret_val.predicted_values = cumhaz
  
      elif pred_type == "surv":
          ret_val.predicted_values = np.exp(-cumhaz)
  
      if pred_only:
          return ret_val.predicted_values
  
      return ret_val
  
imports: import numpy
  from statsmodels.base import model
  import statsmodels.base.model
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.compat.pandas import Appender
label_desc: Use image node_id 19 for calling the PHReg obj's underlying member method code with example usage: obj.predict(params, exog, cov_params, endog, strata, offset, pred_type, pred_only) and returns: ret_val, ret_val, ret_val, ret_val, ret_val, ret_val