0
$\begingroup$

I'm currently trying to identify an appropriate VARMA(p, q)-representation for a multivariate time series using the MTS::-package in R. The series comprises n = 126 observations representing 12-hour intervals each and k = 14 dimensions. The goal is to identify relations among the series. Specifically, I'm interested in finding out whether the first time series is influenced by the other 13 in a unidirectional relationship.

Prior to the analysis, all series were tested for stationarity using the Augmented Dickey-Fuller- (ADF) and the Kwiatkowski-Phillips-Schmidt-Shin-Test (KPSS). In one case—namely, the suspected output time series of the MTS—ADF- und KPSS-test both suggested that the series was nonstationary, DF = -2.9581, p = 0.1784; KPSS-level = 0.7663, p < .01. However, as the graphical inspection didn't suggest a trend (see Fig. 1), I refrained from differencing the series: Fig. 1: Output time series For four other series the KPSS-Test suggested nonstationarity, albeit only barely (only just below p = .05). Since the time series plots didn't show any trends and the ADF-test indicated stationarity, I didn't difference these four series, either.

Following Tsay's (2013) procedure, the first step then is selecting a sensible p-order, using

VARorder(da)

which should yield something like

selected order: aic =  5 
selected order: bic =  2 
selected order: hq =  2 

indicating the appropriate p order by consulting various information criteria. However, for my data, the command gives

Error in solve.default(xpx, xpy) : 
  system is computationally singular: reciprocal condition number = 2.92466e-18

suggesting that the matrix containing my data is non-invertibile. Unfortunately, I can't quite figure out why. Possible problems I've ticked off the list:

  • m < k: Observations by far outnumber dimensions
  • Multicollinearity: I've checked the data by looking for high, significant correlations of individual series—there weren't any. Nevertheless, I tried excluding some series with the highest significant correlations (max r .85, min r = .56 or so). I still received the same error message (obviously with a different condition number).
  • Nonstationarity: I've tried excluding the five series mentioned above. I still received the same error message (obviously with a different condition number).

I'd be very grateful if you would share possible explanations and solutions for this error message.

Note: I'm able to check different VAR models and their information criteria "by hand" using, for example

VAR <- VAR(da,
        2, #p order
        output = T)

But I'm not sure why VARorder(da) wouldn't suggest the appropriate VAR order itself.


Reproducible Example

library(MTS)
library(tseries)

Part of the dataset:

data <- structure(c(16, 31, 22, 34, 6, 89, 40, 171, 15, 17, 36, 2445, 
1998, 3633, 2413, 4595, 3928, 19897, 21616, 32786, 24915, 33185, 
17234, 30094, 21407, 23071, 11214, 12381, 3504, 26791, 15769, 
16420, 6782, 12417, 7355, 6491, 3617, 3553, 1667, 3613, 2584, 
4256, 2329, 3993, 2033, 2234, 1573, 6873, 3229, 6535, 6087, 3137, 
1641, 1554, 2550, 8849, 3142, 3058, 1285, 2012, 1698, 2634, 1662, 
3193, 2917, 2936, 1484, 1417, 0.875, 7.51612903225806, 0.954545454545455, 
1.61764705882353, 0, 0.134831460674157, 7, 0.461988304093567, 
0.666666666666667, 4.64705882352941, 1.36111111111111, 13.1460122699386, 
8.7967967967968, 7.87723644371043, 4.394944053046, 11.9275299238302, 
10.1517311608961, 9.87390058802835, 7.97141006661732, 4.66802903678399, 
6.98539032711218, 3.49477173421727, 3.26819078565626, 6.65528012228351, 
5.59756154528892, 2.66598760348489, 2.12546816479401, 3.29036426782974, 
3.56449771689498, 5.98637602179836, 3.65660473080094, 3.5247868453106, 
1.4967561191389, 7.78650237577515, 2.5675050985724, 2.49622554305962, 
2.10201824716616, 2.08274697438784, 6.02279544091182, 8.03874896208137, 
3.05882352941176, 9.32894736842105, 4.8196650923143, 5.34510393188079, 
2.49335956714215, 2.26812891674127, 7.04704386522568, 5.14607885930452, 
10.0947661814803, 2.95791889824024, 3.70445211105635, 1.01817022633089, 
3.28153564899452, 2.38095238095238, 17.5701960784314, 5.12532489546841, 
2.08911521323997, 2.69882275997384, 8.70817120622568, 1.1317097415507, 
4.82508833922261, 4.56909643128322, 6.26594464500602, 5.98559348575008, 
10.5279396640384, 4.00340599455041, 1.06469002695418, 1.0317572335921, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0257668711656442, 0.03003003003003, 
0.0536746490503716, 0.0298383754662246, 0.0722524483133841, 0.17540733197556, 
0.0690556365281198, 0.0960862324204293, 0.049167327517843, 0.125426449929761, 
0.0515895736025313, 0.0599396541719856, 0.109058284043331, 0.040921194001962, 
0.0410038576567986, 0.0257713572320314, 0.0377998546159438, 0.113299086757991, 
0.268485685491396, 0.0468006848880715, 0.0713763702801462, 0.0328811560011796, 
0.109366191511637, 0.0626784500339905, 0.0514558619627176, 0.0470002764722145, 
0.0278637770897833, 0.296340731853629, 0.0916136174923886, 0.0487616099071207, 
0.101033834586466, 0.0553885787891799, 0.0290508389681943, 0.044761436301033, 
0.040734109221128, 0.191989828353465, 0.0216790339007711, 0.107463611025085, 
0.03672532517215, 0.0266140956136028, 0.0210392094357667, 0.0249847653869592, 
0.0193050193050193, 0.145098039215686, 0.0581986665159905, 0.026098026734564, 
0.0238718116415958, 0.119844357976654, 0.0248508946322068, 0.0318021201413428, 
0.0808656036446469, 0.0415162454873646, 0.053554650798622, 0.116900925608502, 
0.0286103542234332, 0.0235849056603774, 0.0289343683839097, 0.375, 
0.290322580645161, 0.772727272727273, 0.705882352941177, 0.166666666666667, 
0.865168539325843, 0.4, 0.649122807017544, 0.2, 0.235294117647059, 
0.583333333333333, 0.235173824130879, 0.212212212212212, 0.202587393338838, 
0.188976377952756, 0.305331882480958, 1.14052953156823, 0.371010705131427, 
0.390867875647668, 0.246294149942048, 0.459562512542645, 0.30700617748983, 
0.26824881049089, 0.56529540772247, 0.298920913719811, 0.24160201118287, 
0.173711432138398, 0.218318391083111, 0.308219178082192, 0.964540330708074, 
0.278711395776524, 0.253836784409257, 0.171040990858154, 0.349923491986792, 
0.36274643099932, 0.304729625635495, 0.287807575338678, 0.290458767238953, 
0.676064787042591, 0.389150290617216, 0.302631578947368, 0.437734962406015, 
0.369257191927866, 0.378412221387428, 0.288243974422036, 0.355416293643688, 
0.652256834075016, 0.186817983413357, 0.403840198203778, 0.166488140780413, 
0.120584852965336, 0.11954096270322, 0.196221815965874, 0.306306306306306, 
0.467843137254902, 0.269634987004181, 0.210693825588797, 0.320797907128842, 
0.366536964980545, 0.209244532803181, 0.222614840989399, 0.266135155656796, 
0.288808664259928, 0.400876918258691, 0.809050394240658, 0.256811989100817, 
0.207547169811321, 0.271700776287932, 0, 0.032258064516129, 0, 
0, 0, 0, 0, 0, 0.0666666666666667, 0.470588235294118, 0, 1.10265848670757, 
0.956456456456456, 0.891824938067713, 0.534189805221716, 1.06985854189336, 
0.820773930753564, 1.07574006131578, 0.739313471502591, 0.51610443481974, 
0.899859522376079, 0.482326352267591, 0.569571776720436, 0.897288496045723, 
0.59489886485729, 0.326600494126826, 0.332798287854468, 0.413294564251676, 
0.677511415525114, 0.924676197230413, 0.554569091254994, 0.685809987819732, 
0.285608964907107, 0.919626318756543, 0.376614547926581, 0.432444923740564, 
0.375172795134089, 0.312974950745849, 0.816436712657469, 0.725712704123997, 
0.504256965944272, 0.619595864661654, 0.478746243022757, 0.311795642374155, 
0.35120511559272, 0.282900626678603, 0.865225683407502, 0.200785683107813, 
0.738928460823784, 0.280642693190513, 0.444061113849187, 0.184252470513229, 
0.294942108470445, 0.307593307593308, 2.00666666666667, 0.361396767996384, 
0.233290897517505, 0.26651406147809, 1.39844357976654, 0.207256461232604, 
0.406949352179034, 0.706909643128322, 0.466305655836342, 0.382398997807704, 
0.63489886870072, 0.407356948228883, 0.1455525606469, 0.167254763585039, 
3.692549125, 4.49560512903226, 4.57798145454545, 4.55616644117647, 
4.1517775, 4.55915946067416, 4.414734775, 4.45239862573099, 4.59923626666667, 
4.27351670588235, 4.56756277777778, 4.71332677382413, 4.71433729079079, 
4.64946469199009, 4.54387499336925, 4.61450829858542, 4.59745392464358, 
4.59062127747902, 4.5796545548205, 4.57056009741963, 4.60275895199679, 
4.58094156061474, 4.5789076581757, 4.56992570233269, 4.60453077437287, 
4.56723077811972, 4.54220562867844, 4.50252512543413, 4.53417076712329, 
4.642812271957, 4.73391965692181, 4.72565443093788, 4.7228684402831, 
4.50389804397197, 4.54373440829368, 4.53955953104298, 4.59841393502903, 
4.57428621249648, 4.50534188722256, 4.48924115637974, 4.53550577592879, 
4.5775985881109, 4.59262387290683, 4.57157994039569, 4.54940686178062, 
4.44040071486124, 4.41989520343293, 4.37407497235559, 4.46162373737999, 
4.53045742004591, 4.51794264695252, 4.56885864743385, 4.65695446252285, 
4.56900272651223, 4.69658017058824, 4.64684664368855, 4.6081125436028, 
4.55441137606279, 4.51424117354086, 4.4736127445328, 4.36124198233215, 
4.58105553492787, 4.61192891095066, 4.50310046570623, 4.56664731882071, 
4.62616423876022, 4.58632562398922, 4.64963663726182, -1.00848575, 
0.208205709677419, 0.40566890909091, -0.0855384705882356, -0.690468166666666, 
-0.0295627640449432, 0.452610175, 0.0895930935672515, 0.611104066666667, 
0.417308529411764, 0.332088472222222, 0.180272839672802, 0.144860808808809, 
0.18300676355629, 0.143867004144218, 0.178214036343852, 0.177823023676171, 
0.042929696336131, 0.12914535311806, 0.0432498985542606, -0.0148116199478228, 
0.00884347455175494, 0.0122365454334457, 0.0409621980128927, 
-0.0268244293922546, -0.0193391807030476, -0.014688533618691, 
0.0364393041757536, 0.0657794837328769, -0.0669034146168492, 
-0.171487443908935, -0.147008289646772, -0.105609745502802, 0.115533307481678, 
0.0883407481985046, 0.0541025962101367, 0.0282320279236936, 0.021408362510555, 
0.111803380323935, 0.120495728757265, 0.118923532894737, 0.104660343515037, 
0.0249113044224991, -0.00539979163536142, 0.0483729503197248, 
0.172124465980304, 0.104896627463446, 0.00560021533537025, -0.00469096562403237, 
-0.0531827845447586, -0.224251195991457, -0.209440411858464, 
-0.199350975015235, -0.0750004839124836, -0.143215637647059, 
-0.0976614662673745, -0.128307466263526, -0.0236859610856772, 
-0.0395563929961087, 0.0233648389662022, 0.0843769752650179, 
-0.164816440394837, -0.14753778700361, 0.0325523658001883, -0.0288119273225913, 
-0.0765420718664851, -0.084179234501347, -0.0582728390966833, 
0.075183496875, 0.02426648, 0.0271562068181818, 0.0788219729411765, 
0.08238945, 0.0493402817977528, 0.02872707775, 0.0342396149122807, 
0.0252389386666667, 0.0183044394117647, 0.0393951455555556, 0.030129525795501, 
0.031027024024024, 0.0281381137186898, 0.0241995772855367, 0.0443059382350381, 
0.0427790892769857, 0.0707798925139468, 0.0456996758188379, 0.0356332810955896, 
0.0348289032907887, 0.0347024365357842, 0.0775101291841708, 0.0618462749378614, 
0.055448913391414, 0.0476508723913138, 0.0427640608810416, 0.0349019315475325, 
0.0376608332363014, 0.0291473890735695, 0.0512273642596233, 0.0554060555602923, 
0.055020037124742, 0.0705133741346541, 0.0703270357457512, 0.0602180559805885, 
0.0638396116726569, 0.0686834419307627, 0.0542862803719256, 0.0673001500608912, 
0.0537757401122291, 0.0752385264990602, 0.0493120754916273, 0.0511102803706486, 
0.0592842965174619, 0.0449520656893465, 0.0349389627717737, 0.0245876523890586, 
0.0282025061536079, 0.0274653890833971, 0.0221556541366847, 0.0258762808798215, 
0.0308798240219378, 0.0336267406756757, 0.0270719821529412, 0.0252643822657927, 
0.0340072633895608, 0.0398756244833224, 0.0403201777976654, 0.0389208850099404, 
0.0372876319081272, 0.0286002141609719, 0.0268911842719615, 0.0352231508236768, 
0.0511936396057593, 0.0673998798501362, 0.0567748048382749, 0.0426980801693719, 
0.06414205125, 0.04463416, 0.0550190559090909, 0.0298948785294118, 
0.05027976, 0.0365610662921348, 0.03549765, 0.0333254028070175, 
0.07370167, 0.0243866182352941, 0.0536612944444444, 0.112481859713701, 
0.123740007507508, 0.0846842881915772, 0.0415914044757563, 0.0360107505984766, 
0.0406890911405295, 0.0543990335226416, 0.0540293359085862, 0.0459330814982005, 
0.0393132071442906, 0.0735764532168148, 0.0780974799814321, 0.0485794028710042, 
0.0398182972859345, 0.0464864201811798, 0.0442254780631354, 0.0465678176237784, 
0.0462228359018265, 0.0402633947967601, 0.0312809160377957, 0.024281893361754, 
0.0286438232084931, 0.024409238141258, 0.0263882141400408, 0.0358999656447389, 
0.0359386544097318, 0.0363270329299184, 0.0522405332933413, 0.027402047882646, 
0.0303162957430341, 0.0249941684680451, 0.0309246510948905, 0.0325724327573253, 
0.0327702440727988, 0.0296018723813787, 0.0289401659249841, 0.0203381917648771, 
0.0223758755651905, 0.0273244281560826, 0.0175566904879251, 0.0197074362766975, 
0.023432296770262, 0.0277482831402831, 0.0962341700392157, 0.179647012091762, 
0.102838481222152, 0.0773100784826684, 0.0614378007782101, 0.038979027833002, 
0.0237781530035336, 0.0275677927107061, 0.0277110069795427, 0.0353478600062637, 
0.0336300274597189, 0.0324442857629428, 0.0314246574123989, 0.0308544836273818, 
0.0163602775, 0.0231132061290323, 0.0231632545454545, 0.0209158452941176, 
0.0387528266666667, 0.0271994058426966, 0.026902825, 0.0222509414035088, 
0.058897306, 0.0515867205882353, 0.0292888455555556, 0.0403766574233129, 
0.0332412379379379, 0.0326054351775392, 0.221786904682967, 0.0810602167573449, 
0.0491059532841141, 0.0680172347590089, 0.0326915253978534, 0.0276991810528884, 
0.0259867248645394, 0.0343522130480639, 0.0450440430544273, 0.0444782039609224, 
0.0548065791563507, 0.0602607108491179, 0.047723790529695, 0.044412910023423, 
0.035501276826484, 0.0544822339591654, 0.0325835376371362, 0.0324849677222899, 
0.0318033198171631, 0.0348969372634292, 0.0301580518014956, 0.0280368655060853, 
0.0270268415814211, 0.0329757841260906, 0.0939633692861428, 0.108691668973153, 
0.0663763363003096, 0.0421894485432331, 0.042267560455131, 0.0346524795892812, 
0.0314846770782095, 0.0307478555953447, 0.029016169294342, 0.0207958531936563, 
0.0244789454629916, 0.0300657588370314, 0.12321875505175, 0.156969885240676, 
0.0928580414381475, 0.0654918211068211, 0.0233775134901961, 0.0190742917843824, 
0.0303174138446849, 0.0542971883584042, 0.103453411673152, 0.0408653175944334, 
0.0348298761484099, 0.0251192069096431, 0.0224042062575211, 0.0245101381146257, 
0.0287224790881042, 0.038207901226158, 0.0449259481132075, 0.0401095539872971, 
0.06431219625, 0.0652975909677419, 0.0524747768181818, 0.062799505, 
0.030162605, 0.0569843502247191, 0.0426284115, 0.0539778900584795, 
0.0425711646666667, 0.0257402694117647, 0.0768474297222222, 0.0464627524458078, 
0.0536034053753754, 0.0729696639581613, 0.0450630715789474, 0.0411364451468988, 
0.0847578060667006, 0.120990120724732, 0.185452643092617, 0.0843113281269444, 
0.068734945615894, 0.0586641108781076, 0.0519009574399443, 0.0410267597241975, 
0.0358424622249731, 0.0423730277469551, 0.0397486685848047, 0.0372411033648332, 
0.0420564932077626, 0.0338923675603748, 0.0282253626209652, 0.0268264986455542, 
0.0310530747803008, 0.0337104439816381, 0.043912192507138, 0.0456373899445386, 
0.0421923110395355, 0.0444409041176471, 0.0429336742171566, 0.0588641466592859, 
0.0655345405534056, 0.0431616570911654, 0.0445072172348648, 0.0374211347332832, 
0.0462993288834235, 0.0423813194494181, 0.239949278226319, 0.190577284834861, 
0.1841104642428, 0.0978751339433818, 0.0451381913224906, 0.0460525053618107, 
0.0368871042047532, 0.0432519065250965, 0.0314233765372549, 0.0302869826488869, 
0.0396983423297263, 0.0369772504643558, 0.0382621084357977, 0.040080427917495, 
0.0475608491460542, 0.0578263571412301, 0.0642403059566787, 0.0682211473692452, 
0.0509836842338019, 0.0424014640769755, 0.037344879925876, 0.0369145077205363, 
0.039131866875, 0.0238462664516129, 0.0209872036363636, 0.0259887638235294, 
0.0204442366666667, 0.030026912247191, 0.0209505375, 0.0337630015204678, 
0.0298145266666667, 0.0252420076470588, 0.0249937972222222, 0.0241422896850716, 
0.022726420970971, 0.0499888298926507, 0.0325691627020307, 0.0292929473340588, 
0.0267112772403259, 0.0246896783434689, 0.0227751769059956, 0.046425635332154, 
0.0510110744531407, 0.0444560439957812, 0.0583711378089822, 0.0741870801488669, 
0.0726362979399262, 0.0679937124528629, 0.0777878008739076, 0.0545275898554236, 
0.0516303139269406, 0.033688001194431, 0.0255253517027078, 0.0224014677222899, 
0.0257852326747272, 0.0278081968269308, 0.0411679917063222, 0.0399426669234324, 
0.0450783619021288, 0.062533382212215, 0.0766013107378524, 0.0392909634652643, 
0.0677520030959752, 0.0487358949718045, 0.0409500609703735, 0.0484831394941147, 
0.0575566432365962, 0.0467859588182632, 0.041197086013986, 0.0227489903972065, 
0.0231279932796531, 0.0196208806426932, 0.0160949820929851, 0.0216375935607268, 
0.0246020068251066, 0.033239185971686, 0.0231248863137255, 0.0172195677477681, 
0.0204789047422024, 0.0373765438194899, 0.0336685210894942, 0.0286320009940358, 
0.0222365505300353, 0.0203177463933181, 0.0207522869434416, 0.0253700886313811, 
0.0302044114158382, 0.054381401907357, 0.0713482826145553, 0.0612009131968949, 
0.01997317625, 0.0510981161290323, 0.0535885127272727, 0.0252178452941176, 
0.0224598566666667, 0.0366746406741573, 0.03129685, 0.0314023360233918, 
0.0331178286666667, 0.0204349776470588, 0.0457561375, 0.0965838858568507, 
0.0903712287287287, 0.0623022909441233, 0.0528139293410692, 0.0554109867247008, 
0.0436485353869654, 0.0460532286274313, 0.0348924079848261, 0.0353313444763009, 
0.0310355385912101, 0.0307351182763297, 0.0292634714517814, 0.0731096677078487, 
0.0454055047414397, 0.0384545797754757, 0.0389100532370251, 0.0528891220418383, 
0.0338050350171233, 0.0533953797917211, 0.0647036425898916, 0.0532260353227771, 
0.0568478851371277, 0.0296690730450189, 0.0285812043507818, 0.030679913572639, 
0.0334435134089024, 0.0384176397410639, 0.0355680524295141, 0.0277129941876557, 
0.0273872154411765, 0.0841495991541353, 0.0663000777157578, 0.0435628795391936, 
0.0429536104771274, 0.0463072918531782, 0.0305447542911634, 0.021211754837771, 
0.021843973428306, 0.0222774719204285, 0.0177299032364055, 0.0213700710870258, 
0.0283763050578915, 0.0321798532818533, 0.0345026179607843, 0.0326594259238332, 
0.0430079570337365, 0.0410183927403532, 0.0343477150194553, 0.028561967693837, 
0.0349459587161366, 0.0315691636294609, 0.0787937060168472, 0.0552217647979956, 
0.101648102811107, 0.0634827074250681, 0.0437294484501348, 0.0412089564573042, 
0.020856236875, 0.0562083170967742, 0.0308131295454545, 0.0396829629411765, 
0.100044611666667, 0.0456313075280899, 0.04957125, 0.0409887112865497, 
0.0194665993333333, 0.326012851764706, 0.0764910805555556, 0.0588664084867076, 
0.0661107557557558, 0.0637056179466006, 0.0426115840033154, 0.0408393569096844, 
0.039273578385947, 0.0537249937176459, 0.0547690406180607, 0.0606379183187946, 
0.0514832675095324, 0.0479212357993069, 0.0421727962167808, 0.0411807343656543, 
0.0398579445975615, 0.0358253226994929, 0.039641051007669, 0.0322878620466844, 
0.0396163507420091, 0.0345283438468142, 0.0352380429323356, 0.034724115225335, 
0.0309002053966382, 0.0284429056938069, 0.0274001185588035, 0.0347561315667848, 
0.0324393124136024, 0.0407634359696032, 0.0359587619076185, 0.0309502446720177, 
0.0330951520897833, 0.0297507953477444, 0.0458972592099614, 0.0486794437766091, 
0.045119072110182, 0.0354557688898836, 0.0276929989828353, 0.0236847299578059, 
0.0239514215856302, 0.0323983291507269, 0.0246527813372762, 0.0316129636595473, 
0.0329225525289458, 0.0324244047619048, 0.0365879505882353, 0.0652355384789242, 
0.0561048074474857, 0.0688581608894702, 0.0702260007782101, 0.0470446928429423, 
0.0310852744994111, 0.0419289434320425, 0.0312496483754513, 0.040507020357031, 
0.0374511567706548, 0.0364719567438692, 0.0343822626684636, 0.0322565266760762
), .Dim = c(68L, 14L), .Dimnames = list(NULL, NULL))

Test for stationarity using:

adf.test(data[,1])
kpss.test(data[,1])

Identify appropriate VAR(p)-order:

VARorder(data)

Error in solve.default(xpx, xpy) : 
  system is computationally singular: reciprocal condition number = 1.106e-26
$\endgroup$
1
$\begingroup$

You're underestimating the number of parameters required. In a $\text{VAR}(p)$ with $k$ series and no mean, there are $pk^2$ regression coefficients, $pk$ per variable. The function MTS::VARorder tests up to $p=13$, which for $k=14$ gives 2548 parameters, 182 per variable. This is already more than your 126 observations.

You need to reduce the largest $p$ that you'll consider (parameter maxp). When comparing AIC, it has to be done on the same data for all models, which is why you will lose not the first $p$ data points at each $p$, but the largest $p$ for all of them (MTS::VARorder does this automatically). So if that's 13, you effectively only have 113 observations. Take that into consideration when choosing an appropriate largest $p$ to check.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.