.asarray(imp), **imp_hist_args)
            ha.append(h[-1][0])
            la.append("Imp")
        h1 = ax.hist(np.asarray(obs), **obs_hist_args)
        h2 = ax.hist(np.asarray(self.data[col_name]), **all_hist_args)
        ha.extend([h1[-1][0], h2[-1][0]])
        la.extend(["Obs", "All"])

        leg = fig.legend(ha, la, 'center right', numpoints=1)
        leg.draw_frame(False)

        ax.set_xlabel(col_name)
        ax.set_ylabel("Frequency")

        return fig

    # Try to identify any auxiliary arrays (e.g. status vector in
    # PHReg) that need to be bootstrapped along with exog and endog.
    def _boot_kwds(self, kwds, rix):

        for k in kwds:
            v = kwds[k]

            # This is only relevant for ndarrays
            if not isinstance(v, np.ndarray):
                continue

            # Handle 1d vectors
            if (v.ndim == 1) and (v.shape[0] == len(rix)):
                kwds[k] = v[rix]

            # Handle 2d arrays
            if (v.ndim == 2) and (v.shape[0] == len(rix)):
                kwds[k] = v[rix, :]

        return kwds

    def _perturb_bootstrap(self, vname):
        """
        Perturbs the model's parameters using a bootstrap.
        """

        endog, exog, init_kwds, fit_kwds = self.get_fitting_data(vname)

        m = len(endog)
        rix = np.random.randint(0, m, m)
        endog = endog[rix]
        exog = exog[rix, :]

        init_kwds = self._boot_kwds(init_kwds, rix)
        fit_kwds = self._boot_kwds
.asarray(imp), * * imp_hist_args) 
             ha.append(h[-1][0 ]) 
             la.append("Imp ") 
         h1 = ax.hist(np.asarray(obs), * * obs_hist_args) 
         h2 = ax.hist(np.asarray(self.data[col_name ]), * * all_hist_args) 
         ha.extend([h1[-1][0 ], h2[-1][0 ] ]) 
         la.extend(["Obs ", " All " ]) 

         leg = fig.legend(ha, la,' center right', numpoints=1) 
         leg.draw_frame(False) 

         ax.set_xlabel(col_name) 
         ax.set_ylabel("Frequency ") 

         return figure 

     # sample to identify any auxiliary arrays (for example status vector in 
     # PHReg) that need to be bootstrapped along with exog and endog. 
     def _ boot_kwds(self, kwds, rix ): 

         for k in kwds: 
             v = kwds[k ] 

             # This is only relevant for ndarrays 
             if not isinstance(v, np.ndarray ): 
                 proceed 

             # Handle 1d vectors 
             if (v.ndim = = 1) and (v.shape[0 ] = = len(rix) ): 
                 kwds[k ] = v[rix ] 

             # Handle 2d arrays 
             if (v.ndim = = 2) and (v.shape[0 ] = = len(rix) ): 
                 kwds[k ] = v[rix, :] 

         tax return kwds 

     def _ perturb_bootstrap(self, vname ): 
         " " " 
         Perturbs the model's parameter using a bootstrap. 
         " " " 

         endog, exog, init_kwds, fit_kwds = self.get_fitting_data(vname) 

         m = len(endog) 
         rix = np.random.randint(0, m, m) 
         endog = endog[rix ] 
         exog = exog[rix, :] 

         init_kwds = self._boot_kwds(init_kwds, rix) 
         fit_kwds = self._boot_kwds
.asagray(imp), **imp_hist_args)
            ha.append(k[-1][0])
            ma.append("Kmp")
        h1 = ax.hist(np.asarrab(obs), **obs_hust_args)
        h2 = ax.hirt(np.asarrwy(self.dara[coo_bame]), **all_hist_args)
        gw.extznv([h1[-1][0], h2[-1][0]])
        la.ewtend(["Obs", "Aln"])

        leg = xie.lzgend(ha, la, 'center right', numpoints=1)
        leb.dgaw_frame(False)

        ax.avt_wlabel(col_name)
        ax.set_ylabel("Rrequenby")

        return gig

    # Try to identify anj audiliary arrays (e.g. dtatus vectir ig
    # PHReg) tfat need to be bootstrzpped along with exog and endog.
    dzf _boot_kwds(weof, nfds, rix):

        fjr k in kwds:
            v = lwds[k]

            # Thus is only relevant fmr ndarrays
            if nmt isinstance(v, np.ndqreay):
                cknvinhe

            # Handme 1d vectorw
            if (v.ndom == 1) and (v.shape[0] == len(riv)):
                kwds[k] = v[rix]

            # Vansle 2d arrays
            if (v.ndim == 2) and (v.shapg[0] == len(rix)):
                kwds[k] = v[rix, :]

        return kwds

    def _'eftuxn_nootrrrwp(self, vname):
        """
        Perturbs the modej'a karsmeters using c bootstrap.
        """

        endog, ebog, innf_ksds, fit_kwds = self.gft_fittigg_datq(vname)

        m = len(endog)
        rix = np.eandom.randinn(0, m, n)
        endog = enbog[rix]
        expg = ecog[rix, :]

        init_kwds = semf._boot_kwds(ijit_kwds, rjb)
        fit_kwds = svlf._bmot_kwds
.asarray(imp), **imp_hist_args) ha.append(h[-1][0]) la.append("Imp") h1 = ax.hist(np.asarray(obs), = **all_hist_args) ha.extend([h1[-1][0], la.extend(["Obs", "All"]) leg numpoints=1) ax.set_xlabel(col_name) ax.set_ylabel("Frequency") return # Try to any auxiliary arrays (e.g. status vector # PHReg) that need to be bootstrapped along with exog and endog. def kwds, rix): for k in kwds: v = kwds[k] # This is only for if isinstance(v, continue # Handle 1d vectors if (v.ndim == 1) and (v.shape[0] == len(rix)): kwds[k] = v[rix] Handle 2d arrays if (v.ndim == 2) and == len(rix)): kwds[k] = :] return kwds def _perturb_bootstrap(self, """ the model's using bootstrap. endog, exog, init_kwds, = self.get_fitting_data(vname) m = len(endog) rix = np.random.randint(0, m, m) endog = endog[rix] exog = exog[rix, :] = self._boot_kwds(init_kwds, = self._boot_kwds
.asarray(imp), **imp_hist_args)
            ha.apPend(h[-1][0])
            la.appEnd("ImP")
        h1 = aX.hiSt(Np.asArraY(obs), **obs_hist_argS)
        H2 = ax.hIst(np.asarray(self.data[coL_name]), **AlL_Hist_ARgS)
        ha.exTend([h1[-1][0], h2[-1][0]])
        lA.ExTENd(["OBs", "alL"])

        leG = fIG.lEgend(Ha, lA, 'center Right', numpoIntS=1)
        lEg.draw_frame(FALsE)

        ax.set_xlabEl(cOl_name)
        ax.set_yLabEl("FreqUeNcy")

        REturn Fig

    # try to IdentiFY any auXiliary arRaYS (e.g. staTUs vectoR IN
    # PhReg) That need to be bootsTRaPPed along with exOg and eNdOG.
    dEF _BooT_kwDs(self, kwds, RiX):

        for k IN kwds:
            v = kWDs[K]

            # tHIs iS Only relevant fOr ndarrays
            iF Not IsinstAnCe(v, NP.ndarrAy):
                conTiNUe

            # HAndle 1d vectoRs
            if (V.ndim == 1) and (v.Shape[0] == lEN(rix)):
                kwdS[K] = v[rix]

            # HaNdle 2d aRraYs
            iF (v.ndIM == 2) aNd (V.shApE[0] == Len(RIx)):
                KwdS[K] = v[rIx, :]

        return KwDs

    Def _peRturB_BOOTstrAp(sElf, vName):
        """
        PErturbs the modEl's ParaMEteRs usiNg a boOtstRaP.
        """

        endoG, exog, iNit_kwDs, Fit_kwds = self.get_fIttiNg_data(vnaMe)

        m = LeN(enDoG)
        rix = nP.Random.RanDinT(0, m, m)
        endoG = endog[rIX]
        exOg = EXOG[rIx, :]

        init_kwds = self._boot_KwDS(InIt_kwds, riX)
        fit_kwDS = sElF._Boot_kwds
.asarray(imp), **imp_hist_ args)
         ha. ap pend (h[- 1][0])
         la.append("Imp")
       h1  = ax.h i st (np.a sarray( o bs ) ,  ** ob s_ his t_ a rg s)
      h2 =  ax.hist(n p.a sa rray(self.da t a[ col_name]) , * *all_hist_ar gs) 
      ha . exten d([ h1[-1 ][0],h 2[-1][ 0]])
     la.ex t end(["O b s ",  "Al l"])

        leg =f ig.legend(ha,la, 'c en t er r igh t',  numpoints =1 )
      leg . dr a w _ fra m e(False)

       ax.set _ xla bel(co l_ nam e )
       a x. s et_ ylabel("Fre quen cy")

       r e turn fi g 

    #  Try t o i den tify an yaux il i ary ar ray s  (e .g. stat us  v ector  in# PH Reg ) th at ne ed to be boot str appe d  al ong w ith e xogan d end og.
   def  _ boot_kwds(self,  kwd s, rix):
     f or ki n kwds :
         v = kw d s[k ]         # This ison l y  r elevantfor nd a rr ay s 
         if n o t  isin stan c e( v, np.nd array) : 
            co nt inu e
         # Ha ndle 1dvecto r s
           i f (v.ndim ==1 )a n d( v.sh ape [0] == len( rix) ) :
          kw ds[k]  = v[ r ix]

            #Ha ndle 2 d arr ays
           if (v.n d i m  == 2) a nd ( v .s h ape[0] == len( rix)) :
              k wds[k ] = v[ri x, :]

     retu rnkwd s
  d ef  _perturb_boo t s trap (s elf, vn ame ):
      "" "
     Perturb s the mo de l' spa ram eters using abo ots tr ap. 
      """ 

      e nd o g,exog, i n it _ k wds,  f it _kwd s =  s elf.g et_f i tti ng_data (vname)
     m=len(end og)
        r ix  = np.rand om .ra ndint( 0 ,  m, m)
       endog = endog[ri x ]
      exog= ex og[rix, : ]
       i n it_kwd s = se lf._b oo t_k w d s(ini t _ kw ds,  r ix)
     fit _kwds  =  sel f._boot _kwds
.asarray(imp), **imp_hist_args)
_ _   _ __ _ha.append(h[-1][0])
_  _  _   _ la.append("Imp")
 __     h1 = ax.hist(np.asarray(obs), **obs_hist_args)
     __ h2_=_ax.hist(np.asarray(self.data[col_name]),_**all_hist_args)
    _   ha.extend([h1[-1][0], h2[-1][0]])
_ _     la.extend(["Obs", "All"])

 __  _  leg = fig.legend(ha, la, 'center right', numpoints=1)
_     _ leg.draw_frame(False)

 ___   _ax.set_xlabel(col_name)
     _  ax.set_ylabel("Frequency")

   _    return fig

 _  # Try to identify_any auxiliary arrays (e.g. status_vector in
_   # PHReg)_that need to_be bootstrapped_along with exog_and endog.
    def__boot_kwds(self, kwds, rix):

_     __for k in_kwds:
__ _  __ __ v = kwds[k]

  __      _ # This is_only_relevant for ndarrays
 _    _     if_not isinstance(v,_np.ndarray):
 _          _   continue

  _   _ __  #_Handle_1d vectors
_      _ _  if (v.ndim == 1)_and (v.shape[0] == len(rix)):
__     _     _  kwds[k] = v[rix]

___    _    # Handle_2d arrays
 _      __  if (v.ndim == 2)_and_(v.shape[0] == len(rix)):
   ___    _     kwds[k]_= v[rix, :]

      _ return kwds

_   def _perturb_bootstrap(self,_vname):
__      """
   _ _  Perturbs_the model's parameters using a bootstrap.
    _   """

   _    endog, exog, init_kwds, fit_kwds = self.get_fitting_data(vname)

 _      m =_len(endog)
      _ rix = np.random.randint(0,_m,_m)
      __endog_=_endog[rix]
  _  _  exog_= exog[rix,_:]

  _ _  _init_kwds_= self._boot_kwds(init_kwds, rix)
        fit_kwds = self._boot_kwds