
p7]c           @   s  d  d l  m Z d d d g Z d  d l Z d  d l Z d  d l j j Z d  d l	 j j
 Z d  d l j j Z d  d l m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z m Z d  d l m Z m Z m Z d  d l  m! Z! m" Z" d  d	 l# m$ Z$ d  d
 l% m& Z& d Z' d e f d     YZ( d e( f d     YZ) d e( f d     YZ* d e( f d     YZ+ d e f d     YZ, d e e, f d     YZ- d e j. f d     YZ/ e j0 e/ e,  d e j. f d     YZ1 e j0 e1 e-  d e f d     YZ2 d e e2 f d     YZ3 d e j. f d     YZ4 e j0 e4 e2  d e j. f d      YZ5 e j0 e5 e3  d! e f d"     YZ6 d# e e6 f d$     YZ7 d% e j. f d&     YZ8 e j0 e8 e6  d' e j. f d(     YZ9 e j0 e9 e7  d S()   i(   t   divisiont   ZeroInflatedPoissont   ZeroInflatedGeneralizedPoissont   ZeroInflatedNegativeBinomialPN(   t   DiscreteModelt
   CountModelt   Poissont   Logitt   CountResultst   L1CountResultst   Probitt   _discrete_results_docst   _validate_l1_methodt   GeneralizedPoissont   NegativeBinomialP(   t	   zipoissont   zigenpoissont   zinegbin(   t   approx_fprimet   approx_hess(   t   cache_readonly(   t   ConvergenceWarnings  
    exog_infl : array_like or None
        Explanatory variables for the binary inflation model, i.e. for
        mixing probability model. If None, then a constant is used.
    offset : array_like
        Offset is added to the linear prediction with coefficient equal to 1.
    exposure : array_like
        Log(exposure) is added to the linear prediction with coefficient
        equal to 1.
    inflation : string, 'logit' or 'probit'
        The model for the zero inflation, either Logit (default) or Probit
    t   GenericZeroInflatedc           B   s  e  Z d  i e j d 6e e j d 6Z d d d d d d  Z d   Z	 d   Z
 d d d	 d
 d
 d d d d d 	 Z e j j e _ d d d d
 d
 d d d d d d d  Z e j j e _ d   Z d   Z d   Z d   Z d   Z d   Z d d d d d d  Z RS(   sP  
    Generiz Zero Inflated model for count data

    %(params)s
    %(extra_params)s

    Attributes
    ----------
    endog : array
        A reference to the endogenous response variable
    exog : array
        A reference to the exogenous design.
    exog_infl: array
        A reference to the zero-inflated exogenous design.
    t   paramst   extra_paramst   logitt   nonec      
   K   s  t  t |   j | | d | d | d | | | d  k rm d |  _ t j | j |  j f d t j |  _	 n | |  _	 | j
 d |  _ t | j
  d k r d |  _ n | j
 d |  _ | |  _ | d k rt t j |  j	 j
 d  |  j	  |  _ |  j |  _ nS | d k rFt t j |  j	 j
 d  |  j	  |  _ |  j |  _ n t d	 |   | |  _ |  j |  _ t |  j  t |  j	  k rt d
   n  g  |  j j j D] }	 d |	 ^ q}
 |
 t |  j  |  j (t j |  j	 d t j |  _	 |  j j d d g  d g |  _  d  S(   Nt   offsett   exposuret   missingi   t   dtypeR   i    t   probits%   inflation == %s, which is not handleds[   exog and exog_infl have different number ofobservation. `missing` handling is not supporteds
   inflate_%st	   exog_inflt	   inflation(!   t   superR   t   __init__t   Nonet	   k_inflatet   npt   onest   sizet   float64R    t   shapet   lent   k_exogt   inflR   t   zerost
   model_inflt   _hessian_logitt   _hessian_inflateR
   t   _hessian_probitt
   ValueErrorR!   t   k_extrat   exogt   datat   param_namest   listt
   exog_namest   asarrayt
   _init_keyst   extendt   _null_drop_keys(   t   selft   endogR5   R    R   R!   R   R   t   kwargst   it
   infl_names(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR#   8   s@    
			
	&c         C   s   t  j |  j |   S(   s9  
        Loglikelihood of Generic Zero Inflated model

        Parameters
        ----------
        params : array-like
            The parameters of the model.

        Returns
        -------
        loglike : float
            The log-likelihood function of the model evaluated at `params`.
            See notes.

        Notes
        --------
        .. math:: \ln L=\sum_{y_{i}=0}\ln(w_{i}+(1-w_{i})*P_{main\_model})+
            \sum_{y_{i}>0}(\ln(1-w_{i})+L_{main\_model})
            where P - pdf of main model, L - loglike function of main model.

        (   R&   t   sumt
   loglikeobs(   R>   R   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyt   loglikeg   s    c   
      C   s  | |  j   } | |  j  } |  j } |  j j |  } t j | t j t  j d t j t  j  } |  j	 j
 |  } t j | d k  d } t j |  d } t j | d t j }	 t j | | d | | t j | |   |	 | <t j d | |  | | |	 | <|	 S(   se  
        Loglikelihood for observations of Generic Zero Inflated model

        Parameters
        ----------
        params : array-like
            The parameters of the model.

        Returns
        -------
        loglike : ndarray
            The log likelihood for each observation of the model evaluated
            at `params`. See Notes

        Notes
        --------
        .. math:: \ln L=\ln(w_{i}+(1-w_{i})*P_{main\_model})+
            \ln(1-w_{i})+L_{main\_model}
            where P - pdf of main model, L - loglike function of main model.

        for observations :math:`i=1,...,n`

        i   i    R   (   R%   R?   R/   t   predictR&   t   clipt   finfot   floatt   epst
   model_mainRD   t   nonzerot
   zeros_likeR)   t   logt   exp(
   R>   R   t   params_inflt   params_maint   yt   wt   llf_maint   zero_idxt   nonzero_idxt   llf(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyRD      s    	1'#t   bfgsi#   i   t	   nonrobustc
         K   s  | d  k rg t |  d d  t |  d d  } t j |  d k rX | d k rX d  } n  |  j   } n  | d  k r d   } n  t t |   j d | d | d | d	 | d
 | d | |
  } |  j |  | j	  } |  j
 |  } | d  k r i  } n  | j d | d t d |	 |  | S(   NR   i    R   i   c          W   s   |  S(   N(    (   t   x(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyt   <lambda>   t    t   start_paramst   maxitert   dispt   methodt   full_outputt   callbackt   cov_typet   use_selft   use_t(   R$   t   getattrR&   R(   t   _get_start_paramsR"   R   t   fitt   result_classt   _resultst   result_class_wrappert   _get_robustcov_resultst   True(   R>   R]   R`   R^   Ra   R_   Rb   Rc   t   cov_kwdsRe   R@   R   t   mlefitt   zipfitt   result(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyRh      s$    "!				t   l1t   defined_by_methodi    t   autog{Gz?g-C6?gQ?c         K   s  t  |  t j |  d k rQ | d k rQ |  j |  j } | t j |  } n  |  j |  j } |  j r t j |  d k r | |  j |  n | } | d  k rgt |  d d  t |  d d  } t j |  d k r | d k r d  } n  |  j	 j
 d | d | d | d | d	 d d
 | d | d | d |	 d |
 d | |  j } t j t j |  j  |  } n  t t |   j
 d | d | d | d | d	 | d
 | d | d | d |	 d |
 d | |  } |  j |  |  } |  j |  S(   Ni   i    R   R   R]   R`   R^   Ra   R_   Rb   t   alphat	   trim_modet   auto_trim_tolt   size_trim_tolt   qc_tol(   R   R&   R(   R,   R%   R'   R4   R$   Rf   RK   t   fit_regularizedR   t   appendR"   R   t   result_class_regt   result_class_reg_wrapper(   R>   R]   R`   R^   Ra   R_   Rb   Ru   Rv   Rw   Rx   Ry   R@   t   k_paramst   extrat   alpha_pR   t   cntfitt   discretefit(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyRz      s0    
!	-"!	!c         C   sA  | |  j   } | |  j  } |  j } |  j j |  } t j | t j t  j d t j t  j  } |  j	 j
 |  } |  j	 j |  } |  j |  } t j | d k  d }	 t j |  d }
 |  j	 j |  } t j |  j j d |  j f d t j } t j |  j d t j } | |	 j d | |	 t j | |	  j | |	 d d  f <| |
 | |
 d d  f <|  j d k r|  j |	 j | |	 d | |	 d t j | |	  t j | |	  j | |	 d d  f <|  j |
 j | |
 j | |
 d d  f <n |  j d k r.t | |  j  St j | | f  S(   s  
        Generic Zero Inflated model score (gradient) vector of the log-likelihood

        Parameters
        ----------
        params : array-like
            The parameters of the model

        Returns
        -------
        score : ndarray, 1-D
            The score vector of the model, i.e. the first derivative of the
            loglikelihood function, evaluated at `params`
        i   i    R   NR   R   (   R%   R?   R/   RF   R&   RG   RH   RI   RJ   RK   t	   score_obsRD   RL   R.   R5   R*   R,   R)   RM   R    t   TRO   R!   R   t   hstack(   R>   R   RP   RQ   RR   RS   t
   score_mainRT   RW   RU   RV   t   mut   dldpt   dldw(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR      s0    	1+
36'"c         C   s   |  j  |  j d  S(   Ni    (   R   RC   (   R>   R   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyt   score  s    c         C   s   d  S(   N(    (   R>   R   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyt   _hessian_main  s    c      
   C   s  | |  j   } | |  j  } |  j } |  j j |  } t j | t j t  j d t j t  j  } |  j	 j
 |  } |  j	 j |  } |  j |  } t j | d k  d }	 t j |  d }
 t j |  j  |  j |  j  f  } t j |  } x't |  j   D]} xt | d d  D] } |  j |	 | f |  j |	 | f | |	 d | |	 d t j | |	  d d | |	 t j | |	  | |	 | |	 d d t j | |	  d | |	 d j   |  j |
 | f |  j |
 | f | |
 d | |
 j   | | | f <qWqWx t |  j   D]u } xl t |  j  D][ } | |	 | f | |	 d | |	 |  j |	 | f | |	 j   | | | |  j  f <qFWq0W| S(   Ni   i    ii   (   R%   R?   R/   RF   R&   RG   RH   RI   RJ   RK   R   RD   RL   R.   R,   RO   t   rangeR    RC   (   R>   R   RP   RQ   RR   RS   R   RT   RW   RU   RV   t   hess_arrt   pmfRA   t   j(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR0      s,    	1"!vQ]c         C   s   d  S(   N(    (   R>   R   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR2   G  s    c         C   s   |  j  |  } |  j |  } | d k s6 | d k rF t | |  j  S|  j |  j } t j | | f  } | | d |  j  d d  f <| | |  j d  |  j d  f <t j	 |  j |  j d d } | j
 | | | <| S(   s  
        Generic Zero Inflated model Hessian matrix of the loglikelihood

        Parameters
        ----------
        params : array-like
            The parameters of the model

        Returns
        -------
        hess : ndarray, (k_vars, k_vars)
            The Hessian, second derivative of loglikelihood function,
            evaluated at `params`

        Notes
        -----
        Nt   ki   (   R   R1   R$   R   RE   R,   R%   R&   R.   t   triu_indicesR   (   R>   R   t   hess_arr_maint   hess_arr_inflt   dimR   t   tri_idx(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyt   hessianJ  s    "t   meanc         C   s  | d k r |  j } n  | d k r0 |  j } n  | d k rQ t |  d d  } n t j |  } | d k ru d } n  | |  j  } | |  j } d |  j j | |  }	 t j	 | | |  j j
 d   | | }
 |  j j } |  j j } t |  j d d g  } t |  j d d g  } | |  j _ t j | j
 d  |  j _ | |  j _ | |  j _ |  j j |  } | |  j _ | |  j _ t |  d k r| d d k r|  j ` n | |  j _ t |  d k r| d d k r|  j ` n | |  j _ d |	 |	 t j |  } | d k r.|	 t j |
  S| d k rGt j |
  S| d k rW|
 S| d	 k r||	 t j |
  d | S| d
 k r| S| d k r|	 S| d k r|  j | | | | |  St d |   d S(   sH  
        Predict response variable of a count model given exogenous variables.

        Parameters
        ----------
        params : array-like
            The parameters of the model
        exog : array, optional
            A reference to the exogenous design.
            If not assigned, will be used exog from fitting.
        exog_infl : array, optional
            A reference to the zero-inflated exogenous design.
            If not assigned, will be used exog from fitting.
        offset : array, optional
            Offset is added to the linear prediction with coefficient equal to 1.
        exposure : array, optional
            Log(exposure) is added to the linear prediction with coefficient
            equal to 1. If exposure is specified, then it will be logged by the method.
            The user does not need to log it first.
        which : string, optional
            Define values that will be predicted.
            'mean', 'mean-main', 'linear', 'mean-nonzero', 'prob-zero, 'prob', 'prob-main'
            Default is 'mean'.

        Notes
        -----
        R   i    i   R   t   noR   s	   mean-maint   linears   mean-nonzeros	   prob-zeros	   prob-maint   probs   which = %s is not availableN(   R$   R5   R    Rf   R&   RN   R%   R/   RF   t   dotR*   RK   R?   R.   R   R   RD   R+   RO   t   _predict_probR3   (   R>   R   R5   R    R   R   t   whichRP   RQ   t	   prob_maint   lin_predt   tmp_exogt	   tmp_endogt
   tmp_offsett   tmp_exposureRW   t	   prob_zero(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyRF   n  s\    	(""N(   t   __name__t
   __module__t   baset   _model_params_doct   _doc_zi_paramst   _missing_param_doct   __doc__R$   R#   RE   RD   Rh   R   Rz   R   R   R   R0   R2   R   RF   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR   &   s.   .		*			0			'		$	c           B   s]   e  Z d  i e j d 6e e j d 6Z d	 d	 d	 d d d  Z d   Z	 d   Z
 d   Z RS(
   sP  
    Poisson Zero Inflated model for count data

    %(params)s
    %(extra_params)s

    Attributes
    ----------
    endog : array
        A reference to the endogenous response variable
    exog : array
        A reference to the exogenous design.
    exog_infl: array
        A reference to the zero-inflated exogenous design.
    R   R   R   R   c   	      K   s   t  t |   j | | d | d | d | d | d | | t |  j |  j d | d | |  _ t |  _ t	 |  _
 t |  _ t |  _ t |  _ d  S(   NR   R!   R    R   R   (   R"   R   R#   R   R?   R5   RK   R   t   distributiont   ZeroInflatedPoissonResultsRi   t!   ZeroInflatedPoissonResultsWrapperRk   t   L1ZeroInflatedPoissonResultsR|   t#   L1ZeroInflatedPoissonResultsWrapperR}   (	   R>   R?   R5   R    R   R   R!   R   R@   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR#     s    
				c         C   s  | |  j   } | |  j  } |  j } |  j j |  } t j | t j t  j d t j t  j  } |  j	 |  } t j
 | d k  d } t j
 |  d } |  j j |  }	 t j |  j |  j f  }
 d | | t j |	 |  d } x t |  j  D] } x t | d d  D] } |  j | | f |  j | | f |	 | | | d d | | | |	 | t j |	 |  | d j   |	 | |  j | | f |  j | | f j   |
 | | f <qWqW|
 S(   Ni   i    ii   (   R%   R?   R/   RF   R&   RG   RH   RI   RJ   R   RL   RK   R.   R,   RO   R   R5   RC   (   R>   R   RP   RQ   RR   RS   R   RU   RV   R   R   t   coeffRA   R   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s$    	1#< (-c         C   sB  | |  j   } | |  j  } t j t j d t j |  j  d   } t | j  d k  r t }	 t j |  j	 j
 | |   d  d   d  f }
 n+ t }	 |  j	 j
 | |  d  d   d  f }
 t j |
 t j t  j d t j t  j  }
 |  j j
 | | d | d  d   d  f } |  j j | | |
  } |	 r>| d S| S(   Ni    i   i   R   (   R%   R&   t
   atleast_2dt   aranget   maxR?   R+   R*   Rm   R/   RF   R$   t   FalseRG   RH   RI   RJ   RK   R   R   (   R>   R   R5   R    R   R   RP   RQ   t   countst	   transformRS   R   Rq   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s    ++%1c         C   sD   |  j  j d d d d  j } t j t j |  j  d |  } | S(   NR_   i    R`   t   nmg?(   RK   Rh   R   R&   R{   R'   R%   (   R>   R]   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyRg     s    "N(   R   R   R   R   R   R   R   R$   R#   R   R   Rg   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s   			c           B   sd   e  Z d  i e j d 6e d e j d 6Z d d d d d d d  Z d   Z	 d	   Z
 d
   Z RS(   s  
    Zero Inflated Generalized Poisson model for count data

    %(params)s
    %(extra_params)s

    Attributes
    ----------
    endog : array
        A reference to the endogenous response variable
    exog : array
        A reference to the exogenous design.
    exog_infl: array
        A reference to the zero-inflated exogenous design.
    p: scalar
        P denotes parametrizations for ZIGP regression.
    R   s   p : float
        dispersion power parameter for the GeneralizedPoisson model.  p=1 for
        ZIGP-1 and p=2 for ZIGP-2. Default is p=2
    R   R   i   R   c	   
      K   s   t  t |   j | | d | d | d | d | d | |	 t |  j |  j d | d | d | |  _ t |  _ |  j	 d 7_	 |  j
 d 7_
 |  j j d  t |  _ t |  _ t |  _ t |  _ d  S(	   NR   R!   R    R   R   t   pi   Ru   (   R"   R   R#   R   R?   R5   RK   R   R   R,   R4   R9   R{   t%   ZeroInflatedGeneralizedPoissonResultsRi   t,   ZeroInflatedGeneralizedPoissonResultsWrapperRk   t'   L1ZeroInflatedGeneralizedPoissonResultsR|   t.   L1ZeroInflatedGeneralizedPoissonResultsWrapperR}   (
   R>   R?   R5   R    R   R   R!   R   R   R@   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR#   =  s     
				c         C   s-   t  t |   j   } |  j j d | d <| S(   Ni   R   (   R"   R   t   _get_init_kwdsRK   t   parameterization(   R>   t   kwds(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR   P  s    c         C   sI  | |  j   } | |  j  } |  j j } t j t j d t j |  j  d   }	 t | j	  d k  r t
 }
 t j |  j j | |   d  d   d  f } n+ t }
 |  j j | |  d  d   d  f } t j d d  | | d k <|  j j | | d | d | d  d   d  f } |  j j |	 | | d | |  } |
 rE| d S| S(   Ni    i   i   g      ?R   R   i(   R%   RK   R   R&   R   R   R   R?   R+   R*   Rm   R/   RF   R$   R   t	   nextafterR   R   (   R>   R   R5   R    R   R   RP   RQ   R   R   R   RS   R   Rq   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR   U  s    ++%"c      	   C   si   t  j   E t  j d d t t |  j |  j d |  j j d d  j	 } Wd  QXt
 j | d  } | S(   Nt   ignoret   categoryR    R_   i    g?(   t   warningst   catch_warningst   simplefilterR   R   R?   R5   R    Rh   R   R&   R{   (   R>   R]   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyRg   j  s    !N(   R   R   R   R   R   R   R   R$   R#   R   R   Rg   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR   %  s   			c           B   sd   e  Z d  i e j d 6e d e j d 6Z d d d d d d d  Z d   Z	 d	   Z
 d
   Z RS(   s  
    Zero Inflated Generalized Negative Binomial model for count data

    %(params)s
    %(extra_params)s

    Attributes
    ----------
    endog : array
        A reference to the endogenous response variable
    exog : array
        A reference to the exogenous design.
    exog_infl: array
        A reference to the zero-inflated exogenous design.
    p: scalar
        P denotes parametrizations for ZINB regression. p=1 for ZINB-1 and
    p=2 for ZINB-2. Default is p=2
    R   s   p : float
        dispersion power parameter for the NegativeBinomialP model.  p=1 for
        ZINB-1 and p=2 for ZINM-2. Default is p=2
    R   R   i   R   c	   
      K   s   t  t |   j | | d | d | d | d | d | |	 t |  j |  j d | d | d | |  _ t |  _ |  j	 d 7_	 |  j
 d 7_
 |  j j d  t |  _ t |  _ t |  _ t |  _ d  S(	   NR   R!   R    R   R   R   i   Ru   (   R"   R   R#   R   R?   R5   RK   R   R   R,   R4   R9   R{   t#   ZeroInflatedNegativeBinomialResultsRi   t*   ZeroInflatedNegativeBinomialResultsWrapperRk   t%   L1ZeroInflatedNegativeBinomialResultsR|   t,   L1ZeroInflatedNegativeBinomialResultsWrapperR}   (
   R>   R?   R5   R    R   R   R!   R   R   R@   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR#     s     
				c         C   s)   t  t |   j   } |  j j | d <| S(   NR   (   R"   R   R   RK   R   (   R>   R   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s    c         C   sU  | |  j   } | |  j  } |  j j } t j d t j |  j  d  }	 t | j  d k  r t	 }
 t j
 |  j j | |   d  d   d  f } n+ t }
 |  j j | |  d  d   d  f } t j | t j t  j d t j t  j  } |  j j | | d | d | d  d   d  f } |  j j |	 | | d | |  } |
 rQ| d S| S(   Ni    i   i   R   R   i(   R%   RK   R   R&   R   R   R?   R+   R*   Rm   R   R/   RF   R$   R   RG   RH   RI   RJ   R   R   (   R>   R   R5   R    R   R   RP   RQ   R   R   R   RS   R   Rq   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s    "+%1"c      	   C   sf   t  j   6 t  j d d t |  j j d d d d  j } Wd  QXt j t j	 |  j
  |  } | S(   NR   R   R_   i    R`   R   (   R   R   R   R   RK   Rh   R   R&   R{   R.   R%   (   R>   R]   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyRg     s
    $N(   R   R   R   R   R   R   R   R$   R#   R   R   Rg   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR   s  s   			R   c           B   sG   e  Z e i d  d 6d d 6Z e d    Z d d d e e d  Z RS(	   s)   A results class for Zero Inflated Poissont   one_line_descriptionR\   t
   extra_attrc         C   sP   |  j  d d  } d |  j    t j |  j  d d   } d | t j |  S(   NR   R   i   (   RF   R&   RO   (   R>   R   RS   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyt   _dispersion_factor  s    )t   overallt   dydxc         C   s   t  d   d S(   sh   Get marginal effects of the fitted model.

        Not yet implemented for Zero Inflated Models
        s&   not yet implemented for zero inflationN(   t   NotImplementedError(   R>   t   atR`   t   atexogt   dummyt   count(    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyt   get_margeff  s    N(	   R   R   R   R   R   R   R$   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s   	R   c           B   s   e  Z RS(    (   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s   R   c           B   s   e  Z RS(    (   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s   R   c           B   s   e  Z RS(    (   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s   R   c           B   sG   e  Z e i d  d 6d d 6Z e d    Z d d d e e d  Z RS(	   s5   A results class for Zero Inflated Generalized PoissonR   R\   R   c         C   sq   |  j  j j } |  j |  j  j d } t j |  j d d   } d |  j   | } d | | | d | | S(   NiR   R   i   i   (   t   modelRK   R   R   R%   R&   RO   RF   (   R>   R   Ru   R   RS   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s
    R   R   c         C   s   t  d   d S(   sh   Get marginal effects of the fitted model.

        Not yet implemented for Zero Inflated Models
        s&   not yet implemented for zero inflationN(   R   (   R>   R   R`   R   R   R   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s    N(	   R   R   R   R   R   R   R$   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s   	R   c           B   s   e  Z RS(    (   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s   R   c           B   s   e  Z RS(    (   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR      s   R   c           B   s   e  Z RS(    (   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s   R   c           B   sG   e  Z e i d  d 6d d 6Z e d    Z d d d e e d  Z RS(	   s?   A results class for Zero Inflated Genaralized Negative BinomialR   R\   R   c         C   sq   |  j  j j } |  j |  j  j d } t j |  j d d   } d |  j   | } d | | | d | | S(   NiR   R   i   (   R   RK   R   R   R%   R&   RO   RF   (   R>   R   Ru   R   RS   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s
    R   R   c         C   s   t  d   d S(   sh   Get marginal effects of the fitted model.

        Not yet implemented for Zero Inflated Models
        s&   not yet implemented for zero inflationN(   R   (   R>   R   R`   R   R   R   (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s    N(	   R   R   R   R   R   R   R$   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR     s   	R   c           B   s   e  Z RS(    (   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR   $  s   R   c           B   s   e  Z RS(    (   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR   )  s   R   c           B   s   e  Z RS(    (   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyR   0  s   (:   t
   __future__R    t   __all__R   t   numpyR&   t   statsmodels.base.modelR   R   t   statsmodels.base.wrappert   wrappert   wrapt#   statsmodels.regression.linear_modelt
   regressiont   linear_modelt   lmt#   statsmodels.discrete.discrete_modelR   R   R   R   R   R	   R
   R   R   R   R   t   statsmodels.distributionsR   R   R   t   statsmodels.tools.numdiffR   R   t   statsmodels.tools.decoratorsR   t   statsmodels.tools.sm_exceptionsR   R   R   R   R   R   R   R   t   RegressionResultsWrapperR   t   populate_wrapperR   R   R   R   R   R   R   R   R   (    (    (    s?   lib/python2.7/site-packages/statsmodels/discrete/count_model.pyt   <module>   s`   	L XNN						