示例#1
0
def test_hpfilter_pandas():
    dta = macrodata.load_pandas().data
    index = DatetimeIndex(start='1959-01-01', end='2009-10-01', freq='Q')
    dta.index = index
    cycle, trend = hpfilter(dta["realgdp"])
    ndcycle, ndtrend = hpfilter(dta['realgdp'].values)
    assert_equal(cycle.values, ndcycle)
    assert_equal(cycle.index[0], datetime(1959, 3, 31))
    assert_equal(cycle.index[-1], datetime(2009, 9, 30))
    assert_equal(cycle.name, "realgdp")
示例#2
0
def test_hpfilter_pandas():
    dta = macrodata.load_pandas().data
    index = Index(dates_from_range('1959Q1', '2009Q3'))
    dta.index = index
    cycle, trend = hpfilter(dta["realgdp"])
    ndcycle, ndtrend = hpfilter(dta['realgdp'].values)
    assert_equal(cycle.values, ndcycle)
    assert_equal(cycle.index[0], datetime(1959, 3, 31))
    assert_equal(cycle.index[-1], datetime(2009, 9, 30))
    assert_equal(cycle.name, "realgdp")
示例#3
0
def test_hpfilter_pandas():
    dta = macrodata.load_pandas().data
    index = DatetimeIndex(start='1959-01-01', end='2009-10-01', freq='Q')
    dta.index = index
    cycle, trend = hpfilter(dta["realgdp"])
    ndcycle, ndtrend = hpfilter(dta['realgdp'].values)
    assert_equal(cycle.values, ndcycle)
    assert_equal(cycle.index[0], datetime(1959, 3, 31))
    assert_equal(cycle.index[-1], datetime(2009, 9, 30))
    assert_equal(cycle.name, "realgdp")
示例#4
0
def test_hpfilter():
    # Test Hodrick-Prescott Filter. Results taken from Stata.
    hpfilt_res = array([[3.951191484487844718e+01,2.670837085155121713e+03],
        [8.008853245681075350e+01,2.698712467543189177e+03],
        [4.887545512195401898e+01,2.726612544878045810e+03],
        [3.059193256079834100e+01,2.754612067439201837e+03],
        [6.488266733421960453e+01,2.782816332665780465e+03],
        [2.304024204546703913e+01,2.811349757954532834e+03],
        [-1.355312369487364776e+00,2.840377312369487299e+03],
        [-6.746236512580753697e+01,2.870078365125807522e+03],
        [-8.136743836853429457e+01,2.900631438368534418e+03],
        [-6.016789026443257171e+01,2.932172890264432681e+03],
        [-4.636922433138215638e+01,2.964788224331382025e+03],
        [-2.069533915570400495e+01,2.998525339155703932e+03],
        [-2.162152558595607843e+00,3.033403152558595593e+03],
        [-4.718647774311648391e+00,3.069427647774311481e+03],
        [-1.355645669169007306e+01,3.106603456691690099e+03],
        [-4.436926204475639679e+01,3.144932262044756499e+03],
        [-4.332027378211660107e+01,3.184407273782116590e+03],
        [-4.454697106352068658e+01,3.224993971063520803e+03],
        [-2.629875787765286077e+01,3.266630757877652741e+03],
        [-4.426119635629265758e+01,3.309228196356292756e+03],
        [-1.443441190762496262e+01,3.352680411907625057e+03],
        [-2.026686669186437939e+01,3.396853866691864368e+03],
        [-1.913700136208899494e+01,3.441606001362089046e+03],
        [-5.482458977940950717e+01,3.486781589779409387e+03],
        [-1.596244517937793717e+01,3.532213445179378141e+03],
        [-1.374011542874541192e+01,3.577700115428745448e+03],
        [1.325482813403914406e+01,3.623030171865960710e+03],
        [5.603040174253828809e+01,3.667983598257461836e+03],
        [1.030743373627105939e+02,3.712348662637289181e+03],
        [7.217534795943993231e+01,3.755948652040559864e+03],
        [5.462972503693208637e+01,3.798671274963067845e+03],
        [4.407065050666142270e+01,3.840449349493338559e+03],
        [3.749016270204992907e+01,3.881249837297949853e+03],
        [-1.511244199923112319e+00,3.921067244199923152e+03],
        [-9.093507374079763395e+00,3.959919507374079785e+03],
        [-1.685361946760258434e+01,3.997823619467602384e+03],
        [2.822211031434289907e+01,4.034790889685657021e+03],
        [6.117590627896424849e+01,4.070822093721035344e+03],
        [5.433135391434370831e+01,4.105935646085656117e+03],
        [3.810480376716623141e+01,4.140188196232833434e+03],
        [7.042964928802848590e+01,4.173670350711971878e+03],
        [4.996346842507591646e+01,4.206496531574924120e+03],
        [4.455282059571254649e+01,4.238825179404287155e+03],
        [-7.584961950576143863e+00,4.270845961950576566e+03],
        [-4.620339247697120300e+01,4.302776392476971523e+03],
        [-7.054024364552969928e+01,4.334829243645529459e+03],
        [-6.492941099801464588e+01,4.367188410998014660e+03],
        [-1.433567024239555394e+02,4.399993702423955256e+03],
        [-5.932834493089012540e+01,4.433344344930889747e+03],
        [-6.842096758743628016e+01,4.467249967587436004e+03],
        [-6.774011924654860195e+01,4.501683119246548813e+03],
        [-9.030958565658056614e+01,4.536573585656580690e+03],
        [-4.603981499136807543e+01,4.571808814991368308e+03],
        [2.588118806672991923e+01,4.607219811933269739e+03],
        [3.489419371912299539e+01,4.642608806280876706e+03],
        [7.675179642495095322e+01,4.677794203575049323e+03],
        [1.635497817724171910e+02,4.712616218227582976e+03],
        [1.856079654765617306e+02,4.746963034523438182e+03],
        [1.254269446392718237e+02,4.780825055360728584e+03],
        [1.387413113837174024e+02,4.814308688616282780e+03],
        [6.201826599282230745e+01,4.847598734007177882e+03],
        [4.122129542972197669e+01,4.880966704570278125e+03],
        [-4.120287475842360436e+01,4.914722874758424041e+03],
        [-9.486328233441963675e+01,4.949203282334419782e+03],
        [-1.894232132641573116e+02,4.984718213264157384e+03],
        [-1.895766639620087517e+02,5.021518663962008759e+03],
        [-1.464092413342650616e+02,5.059737241334265491e+03],
        [-1.218770668721217589e+02,5.099388066872122181e+03],
        [-4.973075629078175552e+01,5.140393756290781312e+03],
        [-5.365375213897277717e+01,5.182600752138972894e+03],
        [-7.175241524251214287e+01,5.225824415242512259e+03],
        [-7.834757283225462743e+01,5.269846572832254424e+03],
        [-6.264220687943907251e+01,5.314404206879438789e+03],
        [-3.054332122210325906e+00,5.359185332122210639e+03],
        [4.808218808024685131e+01,5.403838811919753425e+03],
        [2.781399326736391231e+00,5.448011600673263274e+03],
        [-2.197570415173231595e+01,5.491380704151732061e+03],
        [1.509441335012807031e+02,5.533624866498719712e+03],
        [1.658909029574851957e+02,5.574409097042514986e+03],
        [2.027292548049981633e+02,5.613492745195001589e+03],
        [1.752101578176061594e+02,5.650738842182393455e+03],
        [1.452808749847536092e+02,5.686137125015246056e+03],
        [1.535481629475025329e+02,5.719786837052497503e+03],
        [1.376169777998875361e+02,5.751878022200112355e+03],
        [1.257703080340770612e+02,5.782696691965922582e+03],
        [-2.524186846895645431e+01,5.812614868468956047e+03],
        [-6.546618027042404719e+01,5.842083180270424236e+03],
        [1.192352023580315290e+01,5.871536479764196883e+03],
        [1.043482970188742911e+02,5.901368702981125352e+03],
        [2.581376184768396342e+01,5.931981238152316109e+03],
        [6.634330880534071184e+01,5.963840691194659485e+03],
        [-4.236780162594641297e+01,5.997429801625946311e+03],
        [-1.759397735321817891e+02,6.033272773532181418e+03],
        [-1.827933311233055065e+02,6.071867331123305121e+03],
        [-2.472312362505917918e+02,6.113601236250591683e+03],
        [-2.877470049336488955e+02,6.158748004933649099e+03],
        [-2.634066336693540507e+02,6.207426633669354487e+03],
        [-1.819572770763625158e+02,6.259576277076362203e+03],
        [-1.175034606274621183e+02,6.314971460627461965e+03],
        [-4.769898649718379602e+01,6.373272986497183410e+03],
        [1.419578280287896632e+01,6.434068217197121157e+03],
        [6.267929662760798237e+01,6.496914703372392069e+03],
        [6.196413196753746888e+01,6.561378868032462378e+03],
        [5.019769125317907310e+01,6.627066308746821051e+03],
        [4.665364933213822951e+01,6.693621350667861407e+03],
        [3.662430749527266016e+01,6.760719692504727391e+03],
        [7.545680850246480986e+01,6.828066191497535328e+03],
        [6.052940492147536133e+01,6.895388595078524304e+03],
        [6.029518881462354329e+01,6.962461811185376064e+03],
        [2.187042136652689805e+01,7.029098578633473153e+03],
        [2.380067926824722235e+01,7.095149320731752596e+03],
        [-7.119129802169481991e+00,7.160478129802169860e+03],
        [-3.194497359120850888e+01,7.224963973591208742e+03],
        [-1.897137038934124575e+01,7.288481370389341464e+03],
        [-1.832687287845146784e+01,7.350884872878451461e+03],
        [4.600482336597542599e+01,7.412017176634024509e+03],
        [2.489047706403016491e+01,7.471709522935970199e+03],
        [6.305909392127250612e+01,7.529821906078727807e+03],
        [4.585212309498183458e+01,7.586229876905018500e+03],
        [9.314260180878318351e+01,7.640848398191216802e+03],
        [1.129819097095369216e+02,7.693621090290463144e+03],
        [1.204662123176703972e+02,7.744549787682329224e+03],
        [1.336860614601246198e+02,7.793706938539875409e+03],
        [1.034567175813735957e+02,7.841240282418626521e+03],
        [1.403118873372050075e+02,7.887381112662795204e+03],
        [1.271726169351004501e+02,7.932425383064899506e+03],
        [8.271925765282139764e+01,7.976756742347178260e+03],
        [-3.197432211752584408e+01,8.020838322117525422e+03],
        [-1.150209535194062482e+02,8.065184953519406008e+03],
        [-1.064694837456772802e+02,8.110291483745677397e+03],
        [-1.190428718925368230e+02,8.156580871892536379e+03],
        [-1.353635336292991269e+02,8.204409533629299403e+03],
        [-9.644348283027102298e+01,8.254059482830271008e+03],
        [-6.143413116116607853e+01,8.305728131161165948e+03],
        [-3.019161311097923317e+01,8.359552613110980019e+03],
        [1.384333163552582846e+00,8.415631666836447039e+03],
        [-4.156016073666614830e+01,8.474045160736666730e+03],
        [-4.843882841860977351e+01,8.534873828418609264e+03],
        [-6.706442838867042155e+01,8.598172428388670596e+03],
        [-2.019644488579979225e+01,8.663965444885800025e+03],
        [-4.316446881084630149e+00,8.732235446881084499e+03],
        [4.435061943264736328e+01,8.802952380567352520e+03],
        [2.820550564155564643e+01,8.876083494358445023e+03],
        [5.155624419490777655e+01,8.951623755805092514e+03],
        [-4.318760899315748247e+00,9.029585760899315574e+03],
        [-6.534632828542271454e+01,9.110014328285422380e+03],
        [-7.226757738268497633e+01,9.192951577382684263e+03],
        [-9.412378615444868046e+01,9.278398786154448317e+03],
        [-1.191240653288368776e+02,9.366312065328836979e+03],
        [-4.953669826751865912e+01,9.456588698267518339e+03],
        [-6.017251579067487910e+01,9.549051515790675694e+03],
        [-5.103438828313483100e+01,9.643492388283135369e+03],
        [-7.343057830678117170e+01,9.739665578306781754e+03],
        [-2.774245193054957781e+01,9.837293451930549054e+03],
        [-3.380481112519191811e+00,9.936052481112519672e+03],
        [-2.672779877794346248e+01,1.003560179877794326e+04],
        [-3.217342505148371856e+01,1.013559842505148299e+04],
        [-4.140567518359966925e+01,1.023568267518359971e+04],
        [-6.687756033938057953e+00,1.033547475603393832e+04],
        [7.300600408459467872e+01,1.043456899591540605e+04],
        [6.862345670680042531e+01,1.053255554329319966e+04],
        [5.497882461487461114e+01,1.062907017538512628e+04],
        [9.612244093055960548e+01,1.072379155906944106e+04],
        [1.978212770103891671e+02,1.081643272298961165e+04],
        [1.362772276848754700e+02,1.090676677231512440e+04],
        [2.637635494867263333e+02,1.099469045051327339e+04],
        [1.876813256815166824e+02,1.108018567431848351e+04],
        [1.711447873158413131e+02,1.116339921268415856e+04],
        [5.257586460826678376e+01,1.124459513539173349e+04],
        [4.710652228531762375e+01,1.132414447771468258e+04],
        [-6.237613484241046535e+01,1.140245113484241119e+04],
        [-9.982044354035315337e+01,1.147994844354035376e+04],
        [-7.916275548997509759e+01,1.155703075548997549e+04],
        [-9.526003459472303803e+01,1.163403003459472347e+04],
        [-1.147987680369169539e+02,1.171122876803691724e+04],
        [-1.900259054765901965e+02,1.178884990547659072e+04],
        [-2.212256473439556430e+02,1.186704464734395515e+04],
        [-2.071394278781845060e+02,1.194584542787818464e+04],
        [-8.968541528904825100e+01,1.202514641528904758e+04],
        [-6.189531564415665343e+01,1.210471231564415575e+04],
        [-5.662878162551714922e+01,1.218425178162551674e+04],
        [-4.961678134413705266e+01,1.226343478134413635e+04],
        [-3.836288992144181975e+01,1.234189588992144127e+04],
        [-8.956671991456460091e+00,1.241923867199145570e+04],
        [3.907028461866866564e+01,1.249504271538133071e+04],
        [1.865299000184495526e+01,1.256888200999815490e+04],
        [4.279803532226833340e+01,1.264035496467773191e+04],
        [3.962735362631610769e+01,1.270907164637368442e+04],
        [1.412691291877854383e+02,1.277466887081221466e+04],
        [1.256537791844366438e+02,1.283680822081556289e+04],
        [7.067642758858892194e+01,1.289523957241141034e+04],
        [1.108876647603192396e+02,1.294979133523968085e+04],
        [9.956490829291760747e+01,1.300033609170708223e+04],
        [1.571612709880937473e+02,1.304681572901190702e+04],
        [2.318746375812715996e+02,1.308923436241872878e+04],
        [2.635546670125277160e+02,1.312769433298747208e+04],
        [2.044220965739259555e+02,1.316244290342607383e+04],
        [2.213739418903714977e+02,1.319389205810962812e+04],
        [1.020184547767112235e+02,1.322258154522328914e+04],
        [-1.072694716663390864e+02,1.324918947166633916e+04],
        [-3.490477058718843182e+02,1.327445770587188417e+04],
        [-3.975570728533530200e+02,1.329906107285335383e+04],
        [-3.331152428080622485e+02,1.332345624280806260e+04]])
    dta = macrodata.load_pandas().data['realgdp'].values
    res = column_stack((hpfilter(dta,1600)))
    assert_almost_equal(res,hpfilt_res,6)
示例#5
0
def test_hpfilter():
    # Test Hodrick-Prescott Filter. Results taken from Stata.
    hpfilt_res = array([[3.951191484487844718e+01,2.670837085155121713e+03],
        [8.008853245681075350e+01,2.698712467543189177e+03],
        [4.887545512195401898e+01,2.726612544878045810e+03],
        [3.059193256079834100e+01,2.754612067439201837e+03],
        [6.488266733421960453e+01,2.782816332665780465e+03],
        [2.304024204546703913e+01,2.811349757954532834e+03],
        [-1.355312369487364776e+00,2.840377312369487299e+03],
        [-6.746236512580753697e+01,2.870078365125807522e+03],
        [-8.136743836853429457e+01,2.900631438368534418e+03],
        [-6.016789026443257171e+01,2.932172890264432681e+03],
        [-4.636922433138215638e+01,2.964788224331382025e+03],
        [-2.069533915570400495e+01,2.998525339155703932e+03],
        [-2.162152558595607843e+00,3.033403152558595593e+03],
        [-4.718647774311648391e+00,3.069427647774311481e+03],
        [-1.355645669169007306e+01,3.106603456691690099e+03],
        [-4.436926204475639679e+01,3.144932262044756499e+03],
        [-4.332027378211660107e+01,3.184407273782116590e+03],
        [-4.454697106352068658e+01,3.224993971063520803e+03],
        [-2.629875787765286077e+01,3.266630757877652741e+03],
        [-4.426119635629265758e+01,3.309228196356292756e+03],
        [-1.443441190762496262e+01,3.352680411907625057e+03],
        [-2.026686669186437939e+01,3.396853866691864368e+03],
        [-1.913700136208899494e+01,3.441606001362089046e+03],
        [-5.482458977940950717e+01,3.486781589779409387e+03],
        [-1.596244517937793717e+01,3.532213445179378141e+03],
        [-1.374011542874541192e+01,3.577700115428745448e+03],
        [1.325482813403914406e+01,3.623030171865960710e+03],
        [5.603040174253828809e+01,3.667983598257461836e+03],
        [1.030743373627105939e+02,3.712348662637289181e+03],
        [7.217534795943993231e+01,3.755948652040559864e+03],
        [5.462972503693208637e+01,3.798671274963067845e+03],
        [4.407065050666142270e+01,3.840449349493338559e+03],
        [3.749016270204992907e+01,3.881249837297949853e+03],
        [-1.511244199923112319e+00,3.921067244199923152e+03],
        [-9.093507374079763395e+00,3.959919507374079785e+03],
        [-1.685361946760258434e+01,3.997823619467602384e+03],
        [2.822211031434289907e+01,4.034790889685657021e+03],
        [6.117590627896424849e+01,4.070822093721035344e+03],
        [5.433135391434370831e+01,4.105935646085656117e+03],
        [3.810480376716623141e+01,4.140188196232833434e+03],
        [7.042964928802848590e+01,4.173670350711971878e+03],
        [4.996346842507591646e+01,4.206496531574924120e+03],
        [4.455282059571254649e+01,4.238825179404287155e+03],
        [-7.584961950576143863e+00,4.270845961950576566e+03],
        [-4.620339247697120300e+01,4.302776392476971523e+03],
        [-7.054024364552969928e+01,4.334829243645529459e+03],
        [-6.492941099801464588e+01,4.367188410998014660e+03],
        [-1.433567024239555394e+02,4.399993702423955256e+03],
        [-5.932834493089012540e+01,4.433344344930889747e+03],
        [-6.842096758743628016e+01,4.467249967587436004e+03],
        [-6.774011924654860195e+01,4.501683119246548813e+03],
        [-9.030958565658056614e+01,4.536573585656580690e+03],
        [-4.603981499136807543e+01,4.571808814991368308e+03],
        [2.588118806672991923e+01,4.607219811933269739e+03],
        [3.489419371912299539e+01,4.642608806280876706e+03],
        [7.675179642495095322e+01,4.677794203575049323e+03],
        [1.635497817724171910e+02,4.712616218227582976e+03],
        [1.856079654765617306e+02,4.746963034523438182e+03],
        [1.254269446392718237e+02,4.780825055360728584e+03],
        [1.387413113837174024e+02,4.814308688616282780e+03],
        [6.201826599282230745e+01,4.847598734007177882e+03],
        [4.122129542972197669e+01,4.880966704570278125e+03],
        [-4.120287475842360436e+01,4.914722874758424041e+03],
        [-9.486328233441963675e+01,4.949203282334419782e+03],
        [-1.894232132641573116e+02,4.984718213264157384e+03],
        [-1.895766639620087517e+02,5.021518663962008759e+03],
        [-1.464092413342650616e+02,5.059737241334265491e+03],
        [-1.218770668721217589e+02,5.099388066872122181e+03],
        [-4.973075629078175552e+01,5.140393756290781312e+03],
        [-5.365375213897277717e+01,5.182600752138972894e+03],
        [-7.175241524251214287e+01,5.225824415242512259e+03],
        [-7.834757283225462743e+01,5.269846572832254424e+03],
        [-6.264220687943907251e+01,5.314404206879438789e+03],
        [-3.054332122210325906e+00,5.359185332122210639e+03],
        [4.808218808024685131e+01,5.403838811919753425e+03],
        [2.781399326736391231e+00,5.448011600673263274e+03],
        [-2.197570415173231595e+01,5.491380704151732061e+03],
        [1.509441335012807031e+02,5.533624866498719712e+03],
        [1.658909029574851957e+02,5.574409097042514986e+03],
        [2.027292548049981633e+02,5.613492745195001589e+03],
        [1.752101578176061594e+02,5.650738842182393455e+03],
        [1.452808749847536092e+02,5.686137125015246056e+03],
        [1.535481629475025329e+02,5.719786837052497503e+03],
        [1.376169777998875361e+02,5.751878022200112355e+03],
        [1.257703080340770612e+02,5.782696691965922582e+03],
        [-2.524186846895645431e+01,5.812614868468956047e+03],
        [-6.546618027042404719e+01,5.842083180270424236e+03],
        [1.192352023580315290e+01,5.871536479764196883e+03],
        [1.043482970188742911e+02,5.901368702981125352e+03],
        [2.581376184768396342e+01,5.931981238152316109e+03],
        [6.634330880534071184e+01,5.963840691194659485e+03],
        [-4.236780162594641297e+01,5.997429801625946311e+03],
        [-1.759397735321817891e+02,6.033272773532181418e+03],
        [-1.827933311233055065e+02,6.071867331123305121e+03],
        [-2.472312362505917918e+02,6.113601236250591683e+03],
        [-2.877470049336488955e+02,6.158748004933649099e+03],
        [-2.634066336693540507e+02,6.207426633669354487e+03],
        [-1.819572770763625158e+02,6.259576277076362203e+03],
        [-1.175034606274621183e+02,6.314971460627461965e+03],
        [-4.769898649718379602e+01,6.373272986497183410e+03],
        [1.419578280287896632e+01,6.434068217197121157e+03],
        [6.267929662760798237e+01,6.496914703372392069e+03],
        [6.196413196753746888e+01,6.561378868032462378e+03],
        [5.019769125317907310e+01,6.627066308746821051e+03],
        [4.665364933213822951e+01,6.693621350667861407e+03],
        [3.662430749527266016e+01,6.760719692504727391e+03],
        [7.545680850246480986e+01,6.828066191497535328e+03],
        [6.052940492147536133e+01,6.895388595078524304e+03],
        [6.029518881462354329e+01,6.962461811185376064e+03],
        [2.187042136652689805e+01,7.029098578633473153e+03],
        [2.380067926824722235e+01,7.095149320731752596e+03],
        [-7.119129802169481991e+00,7.160478129802169860e+03],
        [-3.194497359120850888e+01,7.224963973591208742e+03],
        [-1.897137038934124575e+01,7.288481370389341464e+03],
        [-1.832687287845146784e+01,7.350884872878451461e+03],
        [4.600482336597542599e+01,7.412017176634024509e+03],
        [2.489047706403016491e+01,7.471709522935970199e+03],
        [6.305909392127250612e+01,7.529821906078727807e+03],
        [4.585212309498183458e+01,7.586229876905018500e+03],
        [9.314260180878318351e+01,7.640848398191216802e+03],
        [1.129819097095369216e+02,7.693621090290463144e+03],
        [1.204662123176703972e+02,7.744549787682329224e+03],
        [1.336860614601246198e+02,7.793706938539875409e+03],
        [1.034567175813735957e+02,7.841240282418626521e+03],
        [1.403118873372050075e+02,7.887381112662795204e+03],
        [1.271726169351004501e+02,7.932425383064899506e+03],
        [8.271925765282139764e+01,7.976756742347178260e+03],
        [-3.197432211752584408e+01,8.020838322117525422e+03],
        [-1.150209535194062482e+02,8.065184953519406008e+03],
        [-1.064694837456772802e+02,8.110291483745677397e+03],
        [-1.190428718925368230e+02,8.156580871892536379e+03],
        [-1.353635336292991269e+02,8.204409533629299403e+03],
        [-9.644348283027102298e+01,8.254059482830271008e+03],
        [-6.143413116116607853e+01,8.305728131161165948e+03],
        [-3.019161311097923317e+01,8.359552613110980019e+03],
        [1.384333163552582846e+00,8.415631666836447039e+03],
        [-4.156016073666614830e+01,8.474045160736666730e+03],
        [-4.843882841860977351e+01,8.534873828418609264e+03],
        [-6.706442838867042155e+01,8.598172428388670596e+03],
        [-2.019644488579979225e+01,8.663965444885800025e+03],
        [-4.316446881084630149e+00,8.732235446881084499e+03],
        [4.435061943264736328e+01,8.802952380567352520e+03],
        [2.820550564155564643e+01,8.876083494358445023e+03],
        [5.155624419490777655e+01,8.951623755805092514e+03],
        [-4.318760899315748247e+00,9.029585760899315574e+03],
        [-6.534632828542271454e+01,9.110014328285422380e+03],
        [-7.226757738268497633e+01,9.192951577382684263e+03],
        [-9.412378615444868046e+01,9.278398786154448317e+03],
        [-1.191240653288368776e+02,9.366312065328836979e+03],
        [-4.953669826751865912e+01,9.456588698267518339e+03],
        [-6.017251579067487910e+01,9.549051515790675694e+03],
        [-5.103438828313483100e+01,9.643492388283135369e+03],
        [-7.343057830678117170e+01,9.739665578306781754e+03],
        [-2.774245193054957781e+01,9.837293451930549054e+03],
        [-3.380481112519191811e+00,9.936052481112519672e+03],
        [-2.672779877794346248e+01,1.003560179877794326e+04],
        [-3.217342505148371856e+01,1.013559842505148299e+04],
        [-4.140567518359966925e+01,1.023568267518359971e+04],
        [-6.687756033938057953e+00,1.033547475603393832e+04],
        [7.300600408459467872e+01,1.043456899591540605e+04],
        [6.862345670680042531e+01,1.053255554329319966e+04],
        [5.497882461487461114e+01,1.062907017538512628e+04],
        [9.612244093055960548e+01,1.072379155906944106e+04],
        [1.978212770103891671e+02,1.081643272298961165e+04],
        [1.362772276848754700e+02,1.090676677231512440e+04],
        [2.637635494867263333e+02,1.099469045051327339e+04],
        [1.876813256815166824e+02,1.108018567431848351e+04],
        [1.711447873158413131e+02,1.116339921268415856e+04],
        [5.257586460826678376e+01,1.124459513539173349e+04],
        [4.710652228531762375e+01,1.132414447771468258e+04],
        [-6.237613484241046535e+01,1.140245113484241119e+04],
        [-9.982044354035315337e+01,1.147994844354035376e+04],
        [-7.916275548997509759e+01,1.155703075548997549e+04],
        [-9.526003459472303803e+01,1.163403003459472347e+04],
        [-1.147987680369169539e+02,1.171122876803691724e+04],
        [-1.900259054765901965e+02,1.178884990547659072e+04],
        [-2.212256473439556430e+02,1.186704464734395515e+04],
        [-2.071394278781845060e+02,1.194584542787818464e+04],
        [-8.968541528904825100e+01,1.202514641528904758e+04],
        [-6.189531564415665343e+01,1.210471231564415575e+04],
        [-5.662878162551714922e+01,1.218425178162551674e+04],
        [-4.961678134413705266e+01,1.226343478134413635e+04],
        [-3.836288992144181975e+01,1.234189588992144127e+04],
        [-8.956671991456460091e+00,1.241923867199145570e+04],
        [3.907028461866866564e+01,1.249504271538133071e+04],
        [1.865299000184495526e+01,1.256888200999815490e+04],
        [4.279803532226833340e+01,1.264035496467773191e+04],
        [3.962735362631610769e+01,1.270907164637368442e+04],
        [1.412691291877854383e+02,1.277466887081221466e+04],
        [1.256537791844366438e+02,1.283680822081556289e+04],
        [7.067642758858892194e+01,1.289523957241141034e+04],
        [1.108876647603192396e+02,1.294979133523968085e+04],
        [9.956490829291760747e+01,1.300033609170708223e+04],
        [1.571612709880937473e+02,1.304681572901190702e+04],
        [2.318746375812715996e+02,1.308923436241872878e+04],
        [2.635546670125277160e+02,1.312769433298747208e+04],
        [2.044220965739259555e+02,1.316244290342607383e+04],
        [2.213739418903714977e+02,1.319389205810962812e+04],
        [1.020184547767112235e+02,1.322258154522328914e+04],
        [-1.072694716663390864e+02,1.324918947166633916e+04],
        [-3.490477058718843182e+02,1.327445770587188417e+04],
        [-3.975570728533530200e+02,1.329906107285335383e+04],
        [-3.331152428080622485e+02,1.332345624280806260e+04]])
    dta = macrodata.load_pandas().data['realgdp'].values
    res = column_stack((hpfilter(dta,1600)))
    assert_almost_equal(res,hpfilt_res,6)