".Last.value"<- c(".Last.value", "GJKP.ranks", "HK.test", "HK.test.results", "NP.data", "NP.names", "Rank", "determinant", "last.dump", "make.adf.model", "np.names", "uroot.nuisance", "uroot.test") "GJKP.ranks"<- function(v, score = "wilcoxon") { #integrate the ahat(t) with respect to the chosen score function if(score == "wilcoxon") { J <- ncol(v$sol) dt <- v$sol[1, 2:J] - v$sol[1, 1:(J - 1)] ranks <- as.vector((0.5 * (v$dsol[, 2:J] + v$dsol[, 1:(J - 1)]) %*% dt) - 0.5) #return(ranks, A2 = 1/12) return(ranks) } else if(score == "normal") { J <- ncol(v$sol) dt <- v$sol[1, 2:J] - v$sol[1, 1:(J - 1)] dphi <- c(0, dnorm(qnorm(v$sol[1, 2:(J - 1)])), 0) dphi <- diff(dphi) ranks <- as.vector((((v$dsol[, 2:J] - v$dsol[, 1:(J - 1)]))) %*% ( dphi/dt)) #return(ranks, A2=1) return(ranks) } else if(score == "sign") { j.5 <- sum(v$sol[1, ] < 0.5) w <- (0.5 - v$sol[1, j.5])/(v$sol[1, j.5 + 1] - v$sol[1, j.5]) r <- w * v$dsol[, j.5 + 1] + (1 - w) * v$dsol[, j.5] #return(ranks = r - 1/2, A2=1/4) return(ranks = r - 1/2) } else stop("invalid score function") } "HK.test"<- function(x, scores = c("wilcoxon", "normal", "sign"), p = c(1, 2, 4, 8), l = c( 2, 4, 6, 8)) { np <- length(p) nl <- length(l) nscore <- length(scores) test <- array(0, c(nscore, nl, np)) for(k in 1:np) { for(j in 1:nl) { for(i in 1:nscore) { test[i, j, k] <- uroot.test(log(x), p[k], l[j], score = scores[i]) } } } return(test) } "HK.test.results"<- list(nomgnp = structure(.Data = c(-0.5343158535215502, -0.75430754753274654, -1.5381295800797521, -0.80203808282841571, -1.0569959773926674, -1.6911761406540917, -1.0198158205993813, -1.3276826404755493, -1.8155324428777664, -0.89671683188402884, -1.1495884865565054, -1.7873788196525053, -0.28078550573957806, -0.73280017504985651, -1.0445204170308329, -0.24279739794398525, -0.73924724647478968, -0.75169941682183783, -0.27575404503373635, -0.81419265013287134, -0.68089745220881248, -0.046911412850096923, -0.56459997553080843, -0.55972483673095441, 0.17487720991294031, 0.16864441857353185, -0.85654811338311942, 0.45618399635322282, 0.43992531909206223, -0.67658210165940025, 0.72814726859063716, 0.6632123702167978, -0.55926295117121727, 1.0812352388767161, 0.95043872743222257, -0.30524972433561848, -1.6800485572391026, -1.568383458737677, -1.7607459688845983, -1.6011488035246333, -1.4828448635977685, -1.6638155216219757, -1.6902660542654218, -1.5250780906844694, -1.7618903283965666, -1.4844165987993216, -1.3443842672352071, -1.5101150792860218), .Dim = c(3, 4, 4)), realgnp = structure(.Data = c(-1.1763467750235357, -0.73626748210402582, -1.0416861290251771, -1.9011756796280501, -1.6262008170299742, -1.3475591218126146, -2.9879703423648873, -2.8045905786139143, -1.8930759796245193, -3.1030952488227652, -3.0319858832088133, -1.9324889284949403, -1.4631153112042323, -1.5455176208069572, -0.41770057173658159, -1.6910147046039898, -1.7267407814895179, -0.5244756835906359, -2.4250458200139122, -2.3929481372000847, -0.9074463452674415, -2.7123591010005503, -2.7444860598821426, -0.98011246785877582, -1.0813226910942246, -0.82377377583654976, -0.44949676253594406, -1.1080633355898128, -0.82225233791626451, -0.52778657522024419, -1.6600553841029284, -1.2825368882489903, -0.99610236828430132, -1.8255071670504925, -1.5230177433176841, -0.88237841922306215, -0.30141172913467784, 0.065825868720112091, -0.85743294300462347, -0.38101247659179727, -0.038650068083423861, -0.99935139954080832, -1.0246673633027275, -0.84082100140063787, -1.4172792781483647, -1.4054950082868265, -1.392991702481357, -1.5840501603113071), .Dim = c(3, 4, 4)), pcrgnp = structure(.Data = c(-1.089906318741634, -0.89661518661055872, -0.73870674630465105, -1.8536220217903052, -1.8422647714137108, -1.0282257054604123, -2.9044488613039388, -2.9828314457887206, -1.5518239998116283, -2.8947375759037324, -3.1355408849299273, -1.5651437698359323, -1.5398873522844019, -1.508653467599375, -1.2892781258967445, -1.6969902384930737, -1.6676259571904328, -1.2677020854224974, -2.3324158985858872, -2.2709254226061804, -1.6078290818765124, -2.4940340375845738, -2.5124348734185848, -1.6070159995775937, -0.80680187489867095, -0.52576793334255445, -0.38233275615261419, -0.64825879907753414, -0.36898153406595391, -0.32724241616487548, -1.1024166370649624, -0.79972710361477084, -0.73384291434484616, -1.2695552657596996, -1.0563613867407176, -0.81004052273582206, -0.30768996306501251, -0.10403557469254299, -0.8524405779559423, -0.31010450228489361, -0.078591472436488452, -0.90520667803666721, -0.86948781407403519, -0.67731273340847764, -1.2951930548962962, -1.2316919405082301, -1.1448600976253114, -1.522359421988835), .Dim = c(3, 4, 4)), deflator = structure(.Data = c(-0.023097851784715573, 0.70990903306202924, -0.55810097123840463, 0.38190570739246077, 1.3790408353227068, -0.40207418707760034, 0.88117897352285013, 1.9806854372146523, -0.2562361142129761, 1.2274491572842292, 2.4641518917220946, -0.28264378159451753, 0.98531843311278822, 1.6819185205403553, 0.0029781762378384702, 1.6665889655632813, 2.733298537385541, 0.17797403583519711, 2.428070269554309, 3.6503103034004329, 0.3493318814451345, 3.1441696281803706, 4.5464877454015324, 0.35364230288165266, 0.79827528273825266, 1.6241211792840513, 0.16205782960471193, 1.2479300119169698, 2.3212841257063346, 0.34766014838144788, 1.8502296091572137, 2.9813380236689904, 0.69142507120020036, 2.278067214803793, 3.4265673254883602, 0.87355210606988853, 0.049144752835041938, 0.60094835366450639, -0.2438928971808656, 0.28864587733194913, 0.88937479195012781, -0.029360622957072868, 0.44233451919868472, 1.0042391893896303, 0.13732159877940564, 0.54257735201507806, 1.0893508334421886, 0.30840628293849059), .Dim = c(3, 4, 4)), cpi = structure(.Data = c( -0.3406837314606368, -0.3306981082910303, 0.96050858662541416, -0.26232942935768389, -0.27379528885115834, 0.96731014531607651, -0.17475953226829644, -0.21633710997656852, 0.96784024801147472, -0.17707147846509708, -0.23442507103675592, 0.93957145796678665, -0.90214481490047649, -0.70909793040975666, 0.033430654343553079, -0.5009749988509129, -0.33064262350377183, 0.30663332406050392, -0.22455450781819986, -0.093790916050593864, 0.50503379111916591, -0.08950190551479098, 0.018223193735192655, 0.63051063845925892, -0.79572977646440979, -0.61779995293186429, -0.57022290168255707, -0.4324268495654584, -0.2285099627187348, -0.41078072564090684, -0.10168334589975236, 0.089134286623158587, -0.21677847034851028, 0.058184032350685033, 0.24702918437769927, -0.12013447338439609, -0.84363109070596787, -0.73218197552061648, 0.12820876136950488, -0.71818024787257828, -0.54326953070438444, 0.19694236159855749, -0.56214567142469329, -0.38415846343559101, 0.41855999290326462, -0.44905856425259172, -0.26830436586778772, 0.6885319455594956), .Dim = c(3, 4, 4)), sp500 = structure(.Data = c(-0.62529088875295091, -0.58280615447469897, -1.1063159191667138, -1.035842991235338, -1.1118075472910123, -1.4098209746022565, -1.7866123034504966, -2.1018661040952509, -2.1546963573558022, -2.0871893003721018, -2.5050956360671757, -2.417612622950025, -0.21038141105130226, -0.12864239272234634, -0.17052723828138205, -0.39983746495864469, -0.42485775929169733, -0.10989544569687082, -0.92049345696626261, -1.0591146150716144, -0.5260947935150555, -1.0836788609787815, -1.2632341123975095, -0.72134305565915624, 0.30721960350127153, 0.23051135167482961, 1.2385651848757004, 0.14759697267108418, -0.017162140823771654, 1.1466684442073161, -0.29620081021175948, -0.45492202944452442, 0.82126533344098385, -0.35142150890844448, -0.50128869399466147, 0.75142445583867468, 0.15146428970233572, 0.32771056150845612, -0.012244490890891413, 0.12461816007049964, 0.21249314131587527, 0.15239473704480333, -0.078723234258911923, -0.023210939852587043, 0.074344072772356329, -0.066970099685643492, -0.024481494266747283, 0.24558724116046582), .Dim = c(3, 4, 4)), bondyield = structure(.Data = c(0.38935030479161237, 0.15945835642696904, 0.83212271898592582, 0.847876931257175, 0.67950115567897085, 1.1583809294918563, 1.0906093176270848, 0.94994967232346306, 1.4121879627638707, 1.2085009244183735, 1.0787683807937045, 1.5887613601832333, 0.19559261908652198, -0.16702326329114958, 1.2359890529930591, 0.58081933230251737, 0.21956531128657464, 1.5306031610395814, 0.79239544017044516, 0.44554860767664339, 1.7790985436084816, 0.89432395381632179, 0.54101363253869705, 1.9508983203983643, 0.33172699563058944, 0.23760999175056174, 0.087515343900075981, 0.56928801849333754, 0.47882675525480056, 0.38619139038534933, 0.66213803246060021, 0.56588711948214598, 0.62978627490956018, 0.65884219611265493, 0.54646593341694638, 0.7948258464565352, 0.64915868203941929, 0.39692244353695194, 0.99415854162897221, 0.80566674830574814, 0.51483972614176654, 1.3286764348581377, 0.80305713387627453, 0.45762773843539867, 1.5494655840407126, 0.70288786666923453, 0.27601428172956849, 1.7576971952811062), .Dim = c(3, 4, 4)), industrial = structure(.Data = c(-2.4085441727829409, -2.4360853279603614, -1.4622101225246, -2.5237520852140225, -2.6578202960830142, -1.4117302706494574, -3.6333724989361307, -3.8268123932573275, -2.3527524259975392, -3.8111900559993037, -3.9032247927407604, -2.9337881737907745, -0.65258112302921578, -0.21442545937820423, -0.60077470001284983, -0.92559044711315597, -0.65544581959487491, -0.49693319720681295, -2.37483683883098, -2.1448524942461162, -1.3195835238960614, -2.8487852241828011, -2.5203155334755545, -1.7316942727435363, -1.7201013232159204, -1.5470097883302749, -1.1847923934481441, -2.3473553580846787, -2.4477761724175604, -1.4769170536116047, -4.0723887972771644, -4.4973969416056914, -2.5034581537746949, -4.6108730484434455, -4.9779087008236207, -2.8889661872621133, -0.50497649347219742, -0.93048612555642229, 0.14502275783822571, -0.79144552423855341, -1.1646212030059115, -0.18925834687104381, -1.5193960006572456, -1.9026979961920767, -0.56915938428349044, -1.6844822249740612, -2.0567005955159354, -0.62256389762638964), .Dim = c(3, 4, 4)), employment = structure(.Data = c(-1.7141965458914781, -0.99385181010338997, -1.4579493291594292, -1.9045556752971571, -1.4143683813394246, -1.3936123560217344, -2.6463657052524026, -2.3768660046089227, -1.626720195692668, -2.6393860675161909, -2.4340773380723926, -1.6474134495436736, -0.90138592657365457, -0.13212128225892705, -1.4008350971758277, -0.83884143069765038, -0.29530653392098216, -1.097408731799129, -1.3756710077381857, -0.98793090801451999, -1.259134017663861, -1.4886126246194369, -1.1635038735102716, -1.2912333406535119, -0.91813785037976103, 0.040201856477802167, -1.2128378574542764, -0.98900583544903142, -0.13452374642970355, -1.094470511045093, -1.2135991635899019, -0.48759267714852594, -1.243274390577112, -1.0586694509006538, -0.39903273976784881, -1.1474656738545603, -0.46380927385985693, 0.13408238836470066, -1.6144003975409689, -0.36495430619458435, 0.12744192275676625, -1.6415001685718735, -0.47586221965038433, -0.11825551173788718, -2.0324978349169651, -0.38042240123805993, -0.064710479329630033, -2.2591843238497171), .Dim = c(3, 4, 4)), unemplymnt = structure(.Data = c(-0.99253997650468939, -0.98450169923783371, -1.0438017085680897, -1.8379223238187112, -2.2457520761237824, -1.5028435973269287, -3.4484964278130272, -3.8498804299396525, -2.4518490026708442, -3.7270203379650857, -4.0683687122119858, -2.8271327141764235, -0.77956607030120306, -0.36936528735461138, -1.5091464362523235, -1.4407025088578767, -1.2976962051513201, -1.6142537718172747, -3.4527548696582695, -3.5884382988670289, -2.6400934561380347, -4.5523645041775405, -4.5181740786474371, -3.3583063720938702, -1.2108186232270874, -1.0038505800477271, -0.26933552316121068, -2.8195265637065683, -2.8346837506228475, -1.0034038087130557, -5.13764883856014, -5.4973037076349582, -1.9966149125590458, -6.1143784742773635, -6.0285356704488775, -2.3935604494602223, -0.29959400260736757, -0.18071257721315526, 0.51643054371565422, -1.2789568589776872, -1.3568583076343379, 0.045024873886675865, -2.1960694978991526, -2.3565244784347379, -0.39358319527209318, -2.3506978108493475, -2.4546444594467278, -0.43830683565732431), .Dim = c(3, 4, 4)), wages = structure(.Data = c(-1.0481848507641178, -0.92529366738693231, -2.0686117515835001, -1.0393761577305933, -0.9782838228630073, -1.838605594932557, -1.2179614242185677, -1.2799249213799939, -1.8081679219197637, -1.0347485498402342, -1.0641242235977773, -1.6860600918052768, -0.61083991826497597, -0.96323873716602826, -1.3357837519618707, -0.32486353714218019, -0.64284819221839218, -1.1084570339251694, -0.32512917546891806, -0.67698730064512702, -1.0240449053774645, -0.10533123661215882, -0.45361856507814569, -0.77696103933173477, -0.50378681645142587, -0.09411002887332387, -0.29847273072846381, -0.26668099368438281, 0.14086783284227078, -0.1564181551615822, -0.14917601202487152, 0.19914562255309232, -0.027859944480474574, 0.13142825185809937, 0.45401045096136183, 0.30270161237722393, -0.46139500532323918, -0.37381236139316254, -0.36620607601198341, -0.032953996081756642, -0.053294467967161196, 0.1949356467045833, 0.21546738859509151, 0.091452928150438595, 0.72279843392367038, 0.54049460029216068, 0.38834307286838854, 1.2392090031654144), .Dim = c(3, 4, 4)), realwage = structure(.Data = c(-1.4729596863849674, -1.0802076949785238, -2.5790905445709025, -1.4819558987937667, -1.2355919783064455, -2.4472080016591828, -1.949458685670896, -1.8769386656005294, -2.5070146025279767, -2.0775585190624031, -2.1684259276121334, -2.294958811237473, -0.92163027242349216, 0.43293895532781512, -1.2984183697303919, -0.92833707801797871, 0.19084508291055347, -1.2809068657267191, -1.7539953636402581, -0.85218389925417171, -1.786591486957978, -2.056276847866898, -1.3230777591132679, -1.8497053870399003, -1.3963216715921427, -0.7628172773261741, -1.8965427709988019, -1.2562073217608951, -0.72081500201713888, -1.6579928789337055, -1.4715825429070222, -1.0157125335849844, -1.6002808473849743, -1.5543856900472766, -1.1534948133247567, -1.1912885835925113, 0.053976278588439897, 0.42910538012732591, -0.053275860702476363, 0.2196059253243634, 0.4713728986927519, 0.27575378327868805, 0.03623286059549935, 0.16177937446037793, 0.41467860278698931, -0.088694013951284401, -0.053215063612969349, 0.57677229539745989), .Dim = c(3, 4, 4)), moneystock = structure(.Data = c( -1.5574041895105659, -1.5045664868601238, -1.7357947920045909, -1.2250075533259608, -1.2239290015261188, -1.3772408784153454, -1.1665887229095855, -1.2842529292237312, -1.1701986054001123, -1.2198175576541974, -1.3773227176189371, -1.1181250526852216, -1.9046935897126183, -1.7464857054579834, -1.2076300740139376, -1.3896399702583144, -1.0780017401487063, -1.0049410463615773, -1.2004752841755986, -0.86226111564642416, -0.87092123976933378, -1.1046576314799932, -0.76680084751008604, -0.81220638233841891, -1.4187407990517111, -1.1436670491458152, -0.70402819404565076, -0.95796675631278383, -0.5680006172657448, -0.20720263686323026, -0.54601110467033642, -0.068881176127217003, 0.28851930965534356, -0.35256418961285441, 0.15832377084858074, 0.53270479183518971, -0.24864988247646602, -0.014514163352013831, -0.14578354595965992, 0.54992437385305593, 0.99437251246627056, 0.10733856905699501, 0.74764609636968604, 1.2212889847233388, 0.085624941564000245, 0.68829080421973465, 1.1998019450730846, -0.10573867794079317), .Dim = c(3, 4, 4)), velocity = structure(.Data = c(-1.0780504198537026, -1.0632274285061536, -0.88573967462615455, -1.4830844166014185, -1.5496075287752338, -1.0102704993928988, -1.8495383236182521, -2.016732428317491, -1.1157081493377512, -1.9527931235517852, -2.1291676748136465, -1.0465553273927981, -0.43655173810828307, -0.381447753662155, -0.78286294054203043, -0.72025234490423351, -0.73636626116170567, -0.68728891592041674, -0.97500915868452931, -1.0653402752733774, -0.67259618991346093, -1.0331600473250218, -1.1452906457313681, -0.60327432423707084, -0.79570202995718664, -0.46493735736413422, -1.9949915400908234, -0.81125336796243697, -0.56437336260291371, -1.6875938955737444, -0.98750026629904775, -0.80404054751101595, -1.5489765663901398, -1.0728258911053437, -0.9135691402891406, -1.4077982850755864, -0.5370493588951748, -0.23383482223457608, -0.83944896022853999, -0.63784453975678068, -0.43605906597570709, -0.51799961133952865, -0.72005432759377408, -0.60693589653082469, -0.27516222629027176, -0.68440492285931298, -0.61434651347387192, 0.031089392786245895), .Dim = c(3, 4, 4))) "NP.data"<- list(nomgnp = c(33400, 35300, 35800, 39400, 39600, 38600, 40000, 48300, 60400, 76400, 84000, 91500, 69600, 74100, 85100, 84700, 93100, 97000, 94900, 97000, 103095, 90367, 75820, 58049, 55601, 65054, 72247, 82481, 90446, 84670, 90494, 99678, 124540, 157910, 191592, 210104, 211945, 208509, 231323, 257562, 256484, 284769, 328404, 345498, 364593, 364841, 397960, 419238, 441134, 447334, 483663, 503734, 520097, 560325, 590503, 632410, 684884, 749857, 793927, 864202, 929095, 974126), realgnp = c(116.8, 120.09999999999999, 123.2, 130.19999999999999, 131.40000000000001, 125.59999999999999, 124.5, 134.30000000000001, 135.19999999999999, 151.80000000000001, 146.40000000000001, 140, 127.8, 148, 165.90000000000001, 165.5, 179.40000000000001, 190, 189.80000000000001, 190.90000000000001, 203.59999999999999, 183.5, 169.30000000000001, 144.19999999999999, 141.5, 154.30000000000001, 169.5, 193, 203.19999999999999, 192.90000000000001, 209.40000000000001, 227.19999999999999, 263.69999999999999, 297.80000000000001, 337.10000000000002, 361.30000000000001, 355.19999999999999, 312.60000000000002, 309.89999999999998, 323.69999999999999, 324.10000000000002, 355.30000000000001, 383.39999999999998, 395.10000000000002, 412.80000000000001, 407, 438, 446.10000000000002, 452.5, 447.30000000000001, 475.89999999999998, 487.69999999999999, 497.19999999999999, 529.79999999999995, 551, 581.10000000000002, 617.79999999999995, 658.10000000000002, 675.20000000000005, 706.60000000000002, 724.70000000000005, 720), pcrgnp = c(1291, 1300, 1312, 1366, 1351, 1267, 1238, 1317, 1309, 1471, 1401, 1315, 1177, 1345, 1482, 1450, 1549, 1618, 1594, 1584, 1671, 1490, 1364, 1154, 1126, 1220, 1331, 1506, 1576, 1484, 1598, 1720, 1977, 2208, 2465, 2611, 2538, 2211, 2150, 2208, 2172, 2342, 2485, 2517, 2587, 2506, 2650, 2652, 2642, 2569, 2688, 2699, 2707, 2841, 2912, 3029, 3181, 3349, 3399, 3522, 3577, 3516), deflator = c(25.899999999999999, 25.399999999999999, 24.899999999999999, 24, 24.5, 23, 22.699999999999999, 22.100000000000001, 22.199999999999999, 22.899999999999999, 23.600000000000001, 24.699999999999999, 24.5, 25.399999999999999, 25.699999999999999, 26, 26.5, 27.199999999999999, 28.300000000000001, 28.100000000000001, 29.100000000000001, 29.899999999999999, 29.699999999999999, 30.899999999999999, 31.100000000000001, 31.399999999999999, 32.5, 36.5, 45, 52.600000000000001, 53.799999999999997, 61.299999999999997, 52.200000000000003, 49.5, 50.700000000000003, 50.100000000000001, 51, 51.200000000000003, 50, 50.399999999999999, 50.600000000000001, 49.299999999999997, 44.799999999999997, 40.200000000000003, 39.299999999999997, 42.200000000000003, 42.600000000000001, 42.700000000000003, 44.5, 43.899999999999999, 43.200000000000003, 43.899999999999999, 47.200000000000003, 53, 56.799999999999997, 58.200000000000003, 59.700000000000003, 66.700000000000003, 74.599999999999994, 79.599999999999994, 79.099999999999994, 80.200000000000003, 85.599999999999994, 87.5, 88.299999999999997, 89.599999999999994, 90.900000000000006, 94, 97.5, 100, 101.59999999999999, 103.3, 104.59999999999999, 105.8, 107.2, 108.8, 110.90000000000001, 113.90000000000001, 117.59999999999999, 122.3, 128.19999999999999, 135.30000000000001), cpi = c(27, 27, 30, 37, 48, 47, 44, 43, 41, 40, 38, 37, 37, 37, 35, 33, 32, 32, 30, 29, 30, 30, 30, 29, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 26, 25, 25, 25, 25, 25, 25, 25, 26, 27, 27, 27, 28, 29, 28, 28, 29, 29, 30, 29.699999999999999, 30.100000000000001, 30.399999999999999, 32.700000000000003, 38.399999999999999, 45.100000000000001, 51.799999999999997, 60, 53.600000000000001, 50.200000000000003, 51.100000000000001, 51.200000000000003, 52.5, 53, 52, 51.299999999999997, 51.299999999999997, 50, 45.600000000000001, 40.899999999999999, 38.799999999999997, 40.100000000000001, 41.100000000000001, 41.5, 43, 42.200000000000003, 41.600000000000001, 42, 44.100000000000001, 48.799999999999997, 51.799999999999997, 52.700000000000003, 53.899999999999999, 58.5, 66.900000000000006, 72.099999999999994, 71.400000000000006, 72.099999999999994, 77.799999999999997, 79.5, 80.099999999999994, 80.5, 80.200000000000003, 81.400000000000006, 84.299999999999997, 86.599999999999994, 87.299999999999997, 88.700000000000003, 89.599999999999994, 90.599999999999994, 91.700000000000003, 92.900000000000006, 94.5, 97.200000000000003, 100, 104.2, 109.8, 116.3), sp500 = c(4.6900000000000004, 5.0300000000000002, 4.7999999999999998, 4.5700000000000003, 4.4500000000000002, 4.0599999999999996, 3.1400000000000001, 3.3799999999999999, 4.1200000000000001, 5.21, 6.25, 5.9000000000000004, 5.6299999999999999, 4.7300000000000004, 4.5999999999999996, 5.3600000000000003, 5.5300000000000002, 5.2000000000000002, 5.3200000000000003, 5.2699999999999996, 5.0300000000000002, 5.5499999999999998, 4.7800000000000002, 4.3899999999999997, 4.5300000000000002, 4.2300000000000004, 4.4500000000000002, 5.0499999999999998, 6.29, 6.1500000000000004, 7.8399999999999999, 8.4199999999999999, 7.21, 7.0499999999999998, 8.9900000000000002, 9.6400000000000006, 7.8399999999999999, 7.7800000000000002, 9.7100000000000009, 9.3499999999999996, 9.2400000000000002, 9.5299999999999994, 8.5099999999999998, 8.0800000000000001, 8.3100000000000005, 9.4700000000000006, 8.5, 7.54, 8.7799999999999994, 7.9800000000000004, 6.8600000000000003, 8.4100000000000001, 8.5700000000000003, 9.0500000000000007, 11.15, 12.59, 15.34, 19.949999999999999, 26.02, 21.030000000000001, 13.66, 6.9299999999999997, 8.9600000000000009, 9.8399999999999999, 10.6, 15.470000000000001, 15.41, 11.49, 12.06, 11.02, 9.8200000000000003, 8.6699999999999999, 11.5, 12.470000000000001, 15.16, 17.079999999999998, 15.17, 15.529999999999999, 15.23, 18.399999999999999, 22.34, 24.5, 24.73, 29.690000000000001, 40.490000000000002, 46.619999999999997, 44.380000000000003, 46.240000000000002, 57.380000000000003, 55.850000000000001, 66.269999999999996, 62.380000000000003, 69.870000000000005, 81.370000000000005, 88.170000000000002, 85.260000000000005, 91.930000000000007, 98.700000000000003, 97.840000000000003, 83.819999999999993), bondyield = c(3.2999999999999998, 3.25, 3.2999999999999998, 3.4500000000000002, 3.6000000000000001, 3.5, 3.5499999999999998, 3.7999999999999998, 3.9500000000000002, 3.77, 3.7999999999999998, 3.8999999999999999, 3.8999999999999999, 4, 4.0999999999999996, 4.1500000000000004, 4.0499999999999998, 4.0499999999999998, 4.75, 4.75, 5.0999999999999996, 5.1699999999999999, 4.71, 4.6100000000000003, 4.6600000000000001, 4.5, 4.4000000000000004, 4.2999999999999998, 4.0499999999999998, 4.4199999999999999, 4.4000000000000004, 4.0999999999999996, 4.7000000000000002, 4.1500000000000004, 3.9900000000000002, 3.5, 3.2000000000000002, 3.0800000000000001, 3, 2.75, 2.7000000000000002, 2.6499999999999999, 2.6499999999999999, 2.6499999999999999, 2.6000000000000001, 2.5499999999999998, 2.4300000000000002, 2.5, 2.7999999999999998, 2.7400000000000002, 2.5800000000000001, 2.6699999999999999, 3, 3.1499999999999999, 3, 3.04, 3.0899999999999999, 3.6800000000000002, 3.6099999999999999, 4.0999999999999996, 4.5499999999999998, 4.2199999999999998, 4.4199999999999999, 4.1600000000000001, 4.3300000000000001, 4.3499999999999996, 4.75, 4.9500000000000002, 5.9299999999999997, 6.54, 7.5999999999999996), industrial = c( 0.90000000000000002, 0.90000000000000002, 0.90000000000000002, 1, 1, 1, 1.2, 1.3, 1.3, 1.3999999999999999, 1.5, 1.5, 1.8, 1.8, 1.7, 1.7, 1.7, 1.8, 1.8999999999999999, 2.2000000000000002, 2.5, 2.7999999999999998, 3, 3, 2.8999999999999999, 2.8999999999999999, 3.5, 3.7000000000000002, 3.7999999999999998, 4.0999999999999996, 4.4000000000000004, 4.5, 4.7999999999999998, 4.2999999999999998, 4.2000000000000002, 4.9000000000000004, 4.5999999999999996, 4.9000000000000004, 5.5999999999999996, 6.0999999999999996, 6.2999999999999998, 7.0999999999999996, 7.9000000000000004, 8.0999999999999996, 7.7999999999999998, 9.1999999999999993, 9.8000000000000007, 10, 8.5, 10, 10.6, 10.199999999999999, 11.699999999999999, 12.5, 11.699999999999999, 13.6, 16.100000000000001, 16.199999999999999, 16, 14.1, 14.800000000000001, 11.4, 14.5, 17.300000000000001, 16.199999999999999, 17.800000000000001, 18.899999999999999, 18.899999999999999, 19.600000000000001, 21.800000000000001, 18.100000000000001, 15, 11.699999999999999, 13.800000000000001, 15.1, 17.399999999999999, 20.600000000000001, 22.5, 17.800000000000001, 21.800000000000001, 25.5, 31.800000000000001, 36.600000000000001, 44.700000000000003, 48.299999999999997, 41.299999999999997, 35.200000000000003, 39.399999999999999, 41, 38.799999999999997, 44.899999999999999, 48.700000000000003, 50.600000000000001, 54.799999999999997, 51.799999999999997, 58.399999999999999, 61, 61.799999999999997, 57.799999999999997, 64.700000000000003, 66.200000000000003, 66.599999999999994, 72.099999999999994, 76.5, 81.799999999999997, 89.200000000000003, 98, 100, 105.8, 110.7, 106.7), employment = c(22577, 22792, 23932, 22321, 21102, 22824, 23129, 23604, 24746, 26911, 27909, 28922, 29800, 30506, 30771, 31976, 33749, 34371, 33246, 35072, 35762, 36179, 37433, 38298, 37559, 37511, 39364, 40084, 42712, 41938, 40799, 38568, 41134, 43955, 43607, 45082, 46464, 46496, 46774, 47890, 45740, 42660, 39190, 39010, 41150, 42530, 44710, 46620, 44560, 46120, 48060, 51970, 57720, 63490, 65370, 64260, 58700, 58630, 59803, 59266, 60570, 63062, 63846, 64726, 63460, 65220, 66659, 66871, 65672, 67182, 68292, 68318, 69530, 70500, 72044, 73811, 76018, 77818, 79455, 81408, 81815), unemplymnt = c(4, 5.4000000000000004, 3, 11.699999999999999, 18.399999999999999, 13.699999999999999, 14.4, 14.5, 12.4, 6.5, 5, 4, 3.7000000000000002, 3.8999999999999999, 5.4000000000000004, 4.2999999999999998, 1.7, 2.7999999999999998, 8, 5.0999999999999996, 5.9000000000000004, 6.7000000000000002, 4.5999999999999996, 4.2999999999999998, 7.9000000000000004, 8.5, 5.0999999999999996, 4.5999999999999996, 1.3999999999999999, 1.3999999999999999, 5.2000000000000002, 11.699999999999999, 6.7000000000000002, 2.3999999999999999, 5, 3.2000000000000002, 1.8, 3.2999999999999998, 4.2000000000000002, 3.2000000000000002, 8.6999999999999993, 15.9, 23.600000000000001, 24.899999999999999, 21.699999999999999, 20.100000000000001, 16.899999999999999, 14.300000000000001, 19, 17.199999999999999, 14.6, 9.9000000000000004, 4.7000000000000002, 1.8999999999999999, 1.2, 1.8999999999999999, 3.8999999999999999, 3.8999999999999999, 3.7999999999999998, 5.9000000000000004, 5.2999999999999998, 3.2999999999999998, 3, 2.8999999999999999, 5.5, 4.4000000000000004, 4.0999999999999996, 4.2999999999999998, 6.7999999999999998, 5.5, 5.5, 6.7000000000000002, 5.5, 5.7000000000000002, 5.2000000000000002, 4.5, 3.7999999999999998, 3.7999999999999998, 3.6000000000000001, 3.5, 4.9000000000000004), wages = c(487, 511, 537, 548, 538, 561, 577, 598, 548, 599, 651, 632, 651, 689, 696, 661, 751, 883, 1107, 1293, 1532, 1396, 1283, 1403, 1427, 1450, 1476, 1502, 1534, 1543, 1488, 1369, 1150, 1086, 1153, 1216, 1287, 1376, 1296, 1363, 1432, 1653, 2023, 2349, 2517, 2517, 2517, 2793, 3038, 3095, 3302, 3608, 3832, 4053, 4123, 4356, 4589, 4786, 4946, 5221, 5352, 5507, 5730, 5920, 6196, 6389, 6643, 6880, 7347, 7775, 8150), realwage = c( 19.48, 20.440000000000001, 20.649999999999999, 20.300000000000001, 19.93, 20.780000000000001, 20.609999999999999, 20.620000000000001, 19.57, 21.390000000000001, 22.449999999999999, 21.789999999999999, 21.699999999999999, 23.199999999999999, 23.120000000000001, 21.739999999999998, 22.969999999999999, 22.989999999999998, 24.550000000000001, 24.960000000000001, 25.530000000000001, 26.039999999999999, 25.559999999999999, 27.460000000000001, 27.870000000000001, 27.620000000000001, 27.850000000000001, 28.879999999999999, 29.899999999999999, 30.079999999999998, 29.760000000000002, 30.02, 28.120000000000001, 27.989999999999998, 28.75, 29.59, 31.010000000000002, 32, 30.710000000000001, 32.759999999999998, 34.100000000000001, 37.479999999999997, 41.450000000000003, 45.350000000000001, 47.759999999999998, 46.700000000000003, 43.030000000000001, 41.75, 42.140000000000001, 43.350000000000001, 45.799999999999997, 46.380000000000003, 48.200000000000003, 50.600000000000001, 51.219999999999999, 54.310000000000002, 56.380000000000003, 56.770000000000003, 57.109999999999999, 59.810000000000002, 60.340000000000003, 61.460000000000001, 63.25, 64.560000000000002, 66.700000000000003, 67.609999999999999, 68.340000000000003, 68.799999999999997, 70.510000000000005, 70.810000000000002, 70.079999999999998), moneystock = c(3.6000000000000001, 3.9199999999999999, 4.0800000000000001, 4.4299999999999997, 4.2599999999999998, 4.2800000000000002, 4.4299999999999997, 4.3499999999999996, 4.6399999999999997, 5.2599999999999998, 6.0899999999999999, 6.5999999999999996, 7.4800000000000004, 8.1699999999999999, 8.6799999999999997, 9.2400000000000002, 10.24, 11.08, 11.6, 11.44, 12.68, 13.34, 14.119999999999999, 15.130000000000001, 15.73, 16.390000000000001, 17.59, 20.850000000000001, 24.370000000000001, 26.73, 31.010000000000002, 34.799999999999997, 32.850000000000001, 33.719999999999999, 36.600000000000001, 38.579999999999998, 42.049999999999997, 43.68, 44.729999999999997, 46.420000000000002, 46.600000000000001, 45.729999999999997, 42.689999999999998, 36.049999999999997, 32.219999999999999, 34.359999999999999, 39.07, 43.479999999999997, 45.68, 45.509999999999998, 49.270000000000003, 55.200000000000003, 62.509999999999998, 71.159999999999997, 89.909999999999997, 106.8, 126.59999999999999, 138.69999999999999, 146, 148.09999999999999, 147.5, 150.80000000000001, 156.40000000000001, 164.90000000000001, 171.19999999999999, 177.19999999999999, 183.69999999999999, 186.90000000000001, 191.80000000000001, 201.09999999999999, 210.09999999999999, 210.69999999999999, 221.19999999999999, 233.90000000000001, 249.09999999999999, 264.69999999999999, 285.89999999999998, 308, 331.80000000000001, 361.60000000000002, 385.19999999999999, 401.30000000000001), velocity = c(5.6100000000000003, 5.1600000000000001, 4.6299999999999999, 5.0499999999999998, 4.9500000000000002, 4.71, 4.46, 4.6500000000000004, 4.8899999999999997, 5.0599999999999996, 5.0999999999999996, 5.3099999999999996, 4.4100000000000001, 4.4100000000000001, 4.0099999999999998, 3.8900000000000001, 3.5299999999999998, 3.3799999999999999, 3.29, 3.1499999999999999, 3.0800000000000001, 3, 2.96, 2.8599999999999999, 2.9300000000000002, 2.5699999999999998, 2.73, 2.6299999999999999, 2.7200000000000002, 2.5099999999999998, 2.4900000000000002, 2.4900000000000002, 2.4399999999999999, 2.3100000000000001, 2.29, 2.1400000000000001, 2.1299999999999999, 2.2799999999999998, 2.2799999999999998, 2.0600000000000001, 2.1899999999999999, 2.1699999999999999, 2.0699999999999998, 2.1200000000000001, 2.1499999999999999, 1.8799999999999999, 1.8700000000000001, 2.0899999999999999, 2.1499999999999999, 2.4700000000000002, 2.25, 2.1800000000000002, 1.8799999999999999, 1.8700000000000001, 2.02, 1.95, 1.8700000000000001, 1.9399999999999999, 1.8600000000000001, 1.8300000000000001, 1.9399999999999999, 1.6799999999999999, 1.45, 1.24, 1.3200000000000001, 1.47, 1.49, 1.5700000000000001, 1.6399999999999999, 1.51, 1.5, 1.48, 1.5800000000000001, 1.8200000000000001, 1.75, 1.6100000000000001, 1.3700000000000001, 1.1599999999999999, 1.2, 1.3300000000000001, 1.3, 1.4099999999999999, 1.5700000000000001, 1.5600000000000001, 1.5700000000000001, 1.51, 1.5900000000000001, 1.6599999999999999, 1.6799999999999999, 1.6100000000000001, 1.6799999999999999, 1.72, 1.6899999999999999, 1.71, 1.6899999999999999, 1.71, 1.72, 1.76, 1.72, 1.72, 1.73, 1.73)) "NP.names"<- c("Nominal GNP", "Real GNP", "Per Capita Real GNP", "GNP deflator", "Consumer Price Index", "Common Stock Prices", "Bond Yield", "Industrial Production", "Employment", "Unemployment Rate", "Wages", "Real Wages", "Money Stock", "Velocity") "Rank"<- function(x, na.last = T) { ranks <- sort.list(sort.list(x, na.last = na.last)) if(is.na(na.last)) x <- x[is.orderable(x)] for(i in unique(x[duplicated(x)])) { which <- x == i & !is.na(x) ranks[which] <- max(ranks[which]) } ranks } "determinant"<- function(a) { #see Spector(1995) p.54 prod(diag(qr(a)$qr)) * ifelse(nrow(a) %% 2, 1, -1) } "last.dump"<- structure(.Data = list("No Frame Available", "np.names[1, 3, 4, 5, 2, 11, 10, 12, 6, 7, 8, 9, 13, 14]" = "No Frame Available"), message = "No dim attribute for array subset") "make.adf.model"<- function(x, L = 0, trend = F) { #Construct Data for Augmented Dickey Fuller Model with L lags. x <- as.ts(x) D <- diff(x) if(L > 0) { for(i in 1:L) D <- tsmatrix(D, lag(diff(x), - i)) } D <- tsmatrix(lag(x, -1), D) if(trend == T) D <- tsmatrix(D, c(1:length(x))) D <- cbind(D) #what does this do? dy <- D[, 2] z <- D[, 1] x0 <- D[, - c(1, 2)] #return(data.frame(dy = dy, x0 = as.matrix(x0), z = z)) return(dy, z, x0) } "uroot.nuisance"<- function(x, y, l, res = 0, trend = T, score = "wilcoxon") { # x is the adf X matrix under H_o, without intercept term. # first p terms are \delta y_t and (p+1)th term is trend if trend==T # y is the first difference of the univariate time series # # b is the coefficient vector of l_1 fit of the unit root model under H_0 # r is the residual vector associated with the l_1 fit. # p is the number of autoregression terms in the difference # l is the lag truncation parameter for estimating variance-covariance matrix # w are the weights for the Newey-West estimator # res controls the treatment of zero residuals in computing Fhat # #Computation of Uhat n <- nrow(x) fit <- l1fit(x, y) r <- fit$residuals b <- fit$coefficients ut <- rep(0, n) if(trend == T) { p <- ncol(x) - 1 xb <- b[p + 2] * x[, (p + 1)] ut <- filter(r + xb, b[2:(p + 1)], "rec") } else ut <- y - r w2 <- c(1/2, 1 - (1:l)/(1 + l)) z <- ut z <- c(rep(0, l), z) U <- z for(i in 1:l) U <- tsmatrix(U, lag(z, - i)) sgmu2 <- sum(ut^2)/n Sigma <- matrix(0, 2, 2) Sigma[1, 1] <- (2 * crossprod(crossprod(U)[1, ], w2))/n #Computation of empirical distribution function if(res == 0) Fhat <- (Rank(r) - 0.5)/n else Fhat <- (rank(r) - 0.5)/n if(score == "wilcoxon") vt <- Fhat - 0.5 else if(score == "normal") vt <- qnorm(Fhat) else if(score == "sign") { eps <- .Machine$single.eps vt <- 0.5 * sign(Fhat - 0.5) * (abs(Fhat - 0.5) > eps) } else stop("Invalid Score Function") z <- vt #Computation of nuisance parameter estimates z <- c(rep(0, l), z) V <- z for(i in 1:l) V <- tsmatrix(V, lag(z, - i)) w1 <- c(1, 1 - (1:l)/(1 + l)) w <- 1 - (1:l)/(1 + l) suv <- crossprod(crossprod(U, V)[1, ], w1)/n svu <- crossprod(crossprod(V, U)[1, -1], w)/n Sigma[1, 2] <- suv + svu Sigma[2, 1] <- suv + svu Sigma[2, 2] <- (2 * crossprod(crossprod(V)[1, ], w2))/n return(Sigma, sgmu2) } "uroot.test"<- function(y, p, l, trend = T, res = 0, score = "wilcoxon") { #Compute Hasan-Koenker Regression Rankscore Test of the Unit Root Hypothesis #y is a univariate timeseries #p is the lag length of the Augmented Dickey-Fuller Model #l is the lag truncation length for the Newey-West Estimates #if trend=T then a trend term is included in the ADF model #score should be one of the following: # "wilcoxon" for the logistic model # "normal" for the Gaussian model # "sign" for the Laplace model #res controls the treatment of zero residuals in the estimation of Sigma # M <- make.adf.model(y, p, trend = trend) dy <- M$dy z <- M$z x0 <- M$x0 R <- GJKP.ranks(rq(x0, dy, dual = T), score) x1hat <- as.matrix(qr.resid(qr(cbind(1, x0)), z)) S <- (t(x1hat) %*% R)/sqrt(crossprod(x1hat)) sgmzz <- (crossprod(x1hat))/((length(dy)^2)) adf.coef <- lm(dy ~ cbind(z, x0))$coef[2] w <- uroot.nuisance(x0, dy, l, res, trend, score) D <- determinant(w$Sigma) w1 <- sqrt(w$Sigma[1, 1]/D) w2 <- (w$Sigma[1, 2] * sqrt(sgmzz))/(sqrt(D * w$Sigma[1, 1])) w3 <- (w$Sigma[1, 1] - w$sgmu2)/(2 * sgmzz) rtest <- c(w1 * S - w2 * (length(dy) * adf.coef - w3)) return(rtest) }