import numpy as np

from statsmodels.tools.testing import ParamsTableTestBunch

est = dict(
    rank=8,
    N=3629,
    Q=4.59536484786e-20,
    J=1.66765790329e-16,
    J_df=0,
    k_1=8,
    converged=1,
    has_xtinst=0,
    type=1,
    n_eq=1,
    k=8,
    n_moments=8,
    k_aux=8,
    k_eq_model=0,
    k_eq=8,
    cmdline="gmm ( docvis - exp({xb:private medicaid aget aget2 educyr actlim totchr}+{b0})), instruments(incomet ssiratio aget aget2 educyr actlim totchr) onestep vce(robust)",  # noqa:E501
    cmd="gmm",
    estat_cmd="gmm_estat",
    predict="gmm_p",
    marginsnotok="_ALL",
    eqnames="1",
    technique="gn",
    winit="Unadjusted",
    estimator="onestep",
    wmatrix="robust",
    vce="robust",
    vcetype="Robust",
    params="xb_private xb_medicaid xb_aget xb_aget2 xb_educyr xb_actlim xb_totchr b0",  # noqa:E501
    inst_1="incomet ssiratio aget aget2 educyr actlim totchr _cons",
    params_1="xb_private xb_medicaid xb_aget xb_aget2 xb_educyr xb_actlim xb_totchr b0",  # noqa:E501
    sexp_1="docvis - exp( ({xb_private} *private + {xb_medicaid} *medicaid + {xb_aget} *aget + {xb_aget2} *aget2 + {xb_educyr} *educyr + {xb_actlim} *actlim + {xb_totchr} *totchr) + {b0} )",  # noqa:E501
    properties="b V",
)

params_table = np.array([
    .62093805844748,  .35860052573857,   1.731559252928,  .08335206643438,
    -.08190605683724,  1.3237821737322, np.nan,  1.9599639845401,
    0,  .68895699568302,  .43817618784254,  1.5723286997298,
    .11587434043505,  -.1698525513714,  1.5477665427374, np.nan,
    1.9599639845401,                0,  .25750627258076,  .05009451793791,
    5.1404082358855,  2.741421857e-07,  .15932282159956,  .35568972356197,
    np.nan,  1.9599639845401,                0, -.05352997420414,
    .01103202674353, -4.8522339048464,  1.220785200e-06, -.07515234929795,
    -.03190759911034, np.nan,  1.9599639845401,                0,
    .03106248018916,  .01032090201131,  3.0096671933432,  .00261534090329,
    .01083388395902,  .05129107641931, np.nan,  1.9599639845401,
    0,  .14175365608301,   .0494498280382,  2.8666157539212,
    .00414886404159,  .04483377408643,  .23867353807958, np.nan,
    1.9599639845401,                0,  .23128095221422,  .01565221628818,
    14.776243054406,  2.084750820e-49,  .20060317201116,  .26195873241727,
    np.nan,  1.9599639845401,                0,  .34763567088735,
    .31615794015526,  1.0995633091379,  .27152243570261, -.27202250524333,
    .96729384701803, np.nan,  1.9599639845401,                0
    ]).reshape(8, 9)

params_table_colnames = 'b se z pvalue ll ul df crit eform'.split()

params_table_rownames = ['_cons'] * 8

cov = np.array([
    .12859433705998,  .13265896898444,  .00910916927048, -.00144786113189,
    -.00037337560793, -.00152379041042, -.00336772308907, -.09899309651531,
    .13265896898444,  .19199837159222,  .00979636564963, -.00135323134276,
    .00180599814286, -.00930935415071, -.00460031335865, -.13429156867927,
    .00910916927048,  .00979636564963,  .00250946072743, -.00052373946978,
    5.155389870e-07, -.00016461502154, -.00025816911604, -.00869892550441,
    -.00144786113189, -.00135323134276, -.00052373946978,  .00012170561407,
    8.334416260e-06, -.00002526568199,  .00003797456789,  .00131001446811,
    -.00037337560793,  .00180599814286,  5.155389870e-07,  8.334416260e-06,
    .00010652101833, -.00026856403693, -.00003344387872, -.00122933496346,
    -.00152379041042, -.00930935415071, -.00016461502154, -.00002526568199,
    -.00026856403693,  .00244528549301,  .00003610001892,  .00527355381855,
    -.00336772308907, -.00460031335865, -.00025816911604,  .00003797456789,
    -.00003344387872,  .00003610001892,  .00024499187473,  .00300075896709,
    -.09899309651531, -.13429156867927, -.00869892550441,  .00131001446811,
    -.00122933496346,  .00527355381855,  .00300075896709,  .09995584312322
    ]).reshape(8, 8)

cov_colnames = ['_cons'] * 8

cov_rownames = ['_cons'] * 8


results_addonestep = ParamsTableTestBunch(
    params_table=params_table,
    params_table_colnames=params_table_colnames,
    params_table_rownames=params_table_rownames,
    cov=cov,
    cov_colnames=cov_colnames,
    cov_rownames=cov_rownames,
    **est
)


est = dict(
    rank=8,
    N=3629,
    Q=6.09567389485e-33,
    J=2.21212005644e-29,
    J_df=0,
    k_1=8,
    converged=1,
    has_xtinst=0,
    type=1,
    n_eq=1,
    k=8,
    n_moments=8,
    k_aux=8,
    k_eq_model=0,
    k_eq=8,
    cmdline="gmm ( docvis - exp({xb:private medicaid aget aget2 educyr actlim totchr}+{b0})), instruments(incomet ssiratio aget aget2 educyr actlim totchr) twostep vce(robust)",  # noqa:E501
    cmd="gmm",
    estat_cmd="gmm_estat",
    predict="gmm_p",
    marginsnotok="_ALL",
    eqnames="1",
    technique="gn",
    winit="Unadjusted",
    estimator="twostep",
    wmatrix="robust",
    vce="robust",
    vcetype="Robust",
    params="xb_private xb_medicaid xb_aget xb_aget2 xb_educyr xb_actlim xb_totchr b0",  # noqa:E501
    inst_1="incomet ssiratio aget aget2 educyr actlim totchr _cons",
    params_1="xb_private xb_medicaid xb_aget xb_aget2 xb_educyr xb_actlim xb_totchr b0",  # noqa:E501
    sexp_1="docvis - exp( ({xb_private} *private + {xb_medicaid} *medicaid + {xb_aget} *aget + {xb_aget2} *aget2 + {xb_educyr} *educyr + {xb_actlim} *actlim + {xb_totchr} *totchr) + {b0} )",  # noqa:E501
    properties="b V",
    )

params_table = np.array([
    .6209380584426,  .35860052570457,  1.7315592530786,  .08335206640755,
    -.08190605677548,  1.3237821736607, np.nan,  1.9599639845401,
    0,  .68895699501744,  .43817618789764,  1.5723286980131,
    .11587434083298, -.16985255214498,  1.5477665421799, np.nan,
    1.9599639845401,                0,  .25750627271754,  .05009451794125,
    5.1404082382732,  2.741421823e-07,  .15932282172979,  .35568972370529,
    np.nan,  1.9599639845401,                0, -.05352997423123,
    .01103202674378, -4.8522339071944,  1.220785186e-06, -.07515234932551,
    -.03190759913694, np.nan,  1.9599639845401,                0,
    .03106248018903,  .01032090201422,  3.0096671924822,   .0026153409107,
    .01083388395319,  .05129107642488, np.nan,  1.9599639845401,
    0,  .14175365616691,  .04944982804302,  2.8666157553386,
    .00414886402301,  .04483377416089,  .23867353817294, np.nan,
    1.9599639845401,                0,  .23128095224221,  .01565221628892,
    14.776243055497,  2.084750786e-49,  .20060317203771,  .26195873244672,