B
    ¤ŠãZ®
  ã               @   s€   d Z dZdZe ZdZdZdZdZddlm	Z	m
Z
mZ dd	lmZ dd
lmZmZ deeeƒƒdf Zdd„ Zdd„ Zdd„ ZdS )z%RAND Health Insurance Experiment DataZrestructuredtextzThis is in the public domain.a9  
The data was collected by the RAND corporation as part of the Health
Insurance Experiment (HIE).

http://www.rand.org/health/projects/hie.html

This data was used in::

    Cameron, A.C. amd Trivedi, P.K. 2005.  `Microeconometrics: Methods
        and Applications,` Cambridge: New York.

And was obtained from: <http://cameron.econ.ucdavis.edu/mmabook/mmadata.html>

See randhie/src for the original data and description.  The data included
here contains only a subset of the original data.  The data varies slightly
compared to that reported in Cameron and Trivedi.
z-The RAND Co. Health Insurance Experiment DataÚ aä  ::

    Number of observations - 20,190
    Number of variables - 10
    Variable name definitions::

        mdvis   - Number of outpatient visits to an MD
        lncoins - ln(coinsurance + 1), 0 <= coninsurance <= 100
        idp     - 1 if individual deductible plan, 0 otherwise
        lpi     - ln(max(1, annual participation incentive payment))
        fmde    - 0 if idp = 1; ln(max(1, MDE/(0.01 coinsurance))) otherwise
        physlm  - 1 if the person has a physical limitation
        disea   - number of chronic diseases
        hlthg   - 1 if self-rated health is good
        hlthf   - 1 if self-rated health is fair
        hlthp   - 1 if self-rated health is poor
        (Omitted category is excellent self-rated health)
é    )Ú
recfromtxtÚcolumn_stackÚarray)Úutils)ÚdirnameÚabspathz%s/%szrandhie.csvc              C   s   t ƒ } tj| dtdS )zé
    Loads the RAND HIE data and returns a Dataset class.

    ----------
    endog - response variable, mdvis
    exog - design

    Returns
    Load instance:
        a class of the data with array attrbutes 'endog' and 'exog'
    r   )Ú	endog_idxÚdtype)Ú	_get_dataÚduZprocess_recarrayÚfloat)Údata© r   ú@lib/python3.7/site-packages/statsmodels/datasets/randhie/data.pyÚload6   s    r   c              C   s"   ddl m}  | tƒ}tj|ddS )zé
    Loads the RAND HIE data and returns a Dataset class.

    ----------
    endog - response variable, mdvis
    exog - design

    Returns
    Load instance:
        a class of the data with array attrbutes 'endog' and 'exog'
    r   )Úread_csv)r	   )Zpandasr   ÚPATHr   Zprocess_recarray_pandas)r   r   r   r   r   Úload_pandasE   s    r   c           	   C   s*   t tdƒ} t| ddtd}W d Q R X |S )NÚrbú,T)Z	delimiterÚnamesr
   )Úopenr   r   r   )Úfr   r   r   r   r   U   s    r   N)Ú__doc__Z__docformat__Z	COPYRIGHTZTITLEZSOURCEZ
DESCRSHORTZ	DESCRLONGZNOTEZnumpyr   r   r   Zstatsmodels.datasetsr   r   Úos.pathr   r   Ú__file__r   r   r   r   r   r   r   r   Ú<module>   s   