2
$\begingroup$

I have daily financial time series of stock returns (35 stocks) which I took the natural logarithm and subtracted the risk-free rate. However, I get the issue non-invertibility of the covariance matrix which makes the matrix singular. The determinant of the covariance-matrix is also zero.

Inverting a covariance matrix of financial times have been done multiple times. What is the reason for this issue and is there a fix for this?

Here is a small output of my data using R with dput:

structure(c(-0.00320406968829613, -0.00940813201973583, 0.0314625112393164, 
-0.023476404315932, 0.025038556843715, 0.00105390714331188, 0.0162733269974423, 
-0.0059535086971927, 0.000367019087438071, -0.0215065292171232, 
0.0131124207932027, -0.000130580531258137, -0.0309063201143783, 
-0.0646778076438773, 0.0644161023890848, -0.000130580531258137, 
-0.00270802426238616, -0.0105213221887412, 0.00860764854893942, 
-0.0166097109500275, 0.00739866530698332, -0.0127110157655258, 
0.0124498340374854, -0.00263403804030052, -0.0137380214798324, 
-0.0125930948660728, -0.0084887366161403, -0.0212796334395941, 
-0.018512861391785, -0.00315528080562506, 0.0153994716846578, 
0.0104652373981737, -0.000130580531258137, -0.00395119265355139, 
0.00468001246988782, -0.0146323557333682, 0.0110441710553396, 
-0.0113053484232381, 0.0154793395295921, -0.00456575799510228, 
0.00987235306334745, -0.0279426212757295, 0.0226924111064216, 
0.00238634890425745, -0.0128472804264984, -0.010284837302932, 
0.0359507225122209, 0.00640649909642104, 0.000367424968775868, 
-0.0112782276257744, 0.01250328553578, -0.0141228275552382, -0.00769859180135913, 
-0.0116694861312546, -0.00390169891198901, -0.00787438530878407, 
0.00395035504175073, 0.00392283787638132, 0.00390647611102755, 
0.00390109112604679, -0.0040829817490552, -0.0115791972058222, 
0.00815405731997382, -0.0104948241100902, -0.0104754768882466, 
-0.0366239675626633, 0.0207541317112487, 0.0137588350721667, 
-0.000130580531258137, -0.00307620141105404, 0.00281503921560566, 
-0.000130580531258137, -0.000654585640971176, -0.00757427339904899, 
0.016797332765512, -0.00118056916194883, 0.0297226004153132, 
-0.00753084421502183, -0.00383119754495659, -0.0265083284008476, 
0.00591252060546296, 0.0266203744618406, 0.0230618578286106, 
-0.00300039821519316, -0.000130580531258137, -0.01024211566586, 
0.0166655972192637, -0.00346733021540688, -0.0110209089643256, 
0.0121148629799816, 0.011983679092543, 0.00786483499172435, 0.00451102662864941, 
-0.000130580531258137, -0.00785289724728559, -0.0094884429484113, 
0.0177826641815308, 0.0174674590726426, 0.0171631552458502, -0.00586200575234813, 
-0.000130580531258137, -0.000130580531258137, -0.006033839478391, 
0.0145781592469385, 0.0013772355101275, -0.000130580531258137, 
-0.012285322573913, 0.00140270262465335, 0.0148045739216106, 
-0.00230346203453512, 0.0231536477331619, 0.0217483411876059, 
-0.00253763523429977, -0.00496214019365293, 0.0166787142670425, 
-0.00490448411213631, -0.00926470352432169, -0.00933256125045855, 
-0.000130580531258137, 0.00907138913150376, -0.000130580531258137, 
-0.0954403313035856, 0.0197007890360375, -0.000130580531258137, 
0.00358753821501119, 0.00706256609659139, 0.00376516377875027, 
-0.00513737804438225, 0.00747941908286911, -0.00392834511050855, 
-0.000888771069614558, -0.0108451665743174, -0.00663106807707135, 
-0.0176746646239274, 0.0703350908665386, -0.00633532407742252, 
-0.00832337495701473, -0.00602651521318636, 0.0139581290102737, 
0.00104196803233584), .Dim = c(4L, 35L), .Dimnames = list(c("1997-09-01", 
"1997-09-02", "1997-09-03", "1997-09-04"), c("AUS.AND NZ.BANKING GP.", 
"AMCOR", "WESTPAC BANKING", "FORTESCUE METALS GP.", "BHP BILLITON", 
"CALTEX AUSTRALIA", "COMPUTERSHARE", "CSL", "TRANSURBAN GROUP", 
"COCHLEAR", "ORIGIN ENERGY (EX BORAL)", "COMMONWEALTH BK.OF AUS.", 
"RIO TINTO", "ARISTOCRAT LEISURE", "GPT GROUP", "ORICA", "LENDLEASE GROUP", 
"SUNCORP GROUP", "NATIONAL AUS.BANK", "NEWCREST MINING", "OIL SEARCH", 
"QANTAS AIRWAYS", "QBE INSURANCE GROUP", "SANTOS", "SONIC HEALTHCARE", 
"STOCKLAND", "WESFARMERS", "WOODSIDE PETROLEUM", "WOOLWORTHS GROUP", 
"DEXUS", "GOODMAN GROUP", "BRAMBLES", "MACQUARIE GROUP", "JAMES HARDIE INDS.CDI.", 
"AGL ENERGY")))
$\endgroup$
6
  • $\begingroup$ To be honest, this sounds like a programming error. I have a hard time imagining that your covariance matrix would be noninvertible. Ill-conditioned, yes, noninvertible, no. Anyway, we likely won't be able to help you without seeing the actual data. $\endgroup$ Commented Jul 6, 2018 at 8:05
  • $\begingroup$ @StephanKolassa I am programming in R, and if I adjust the tolerance of the invertibility function it provides invertibility, but it is very unstable in the context of my maximization problem. I have added a small output of my data. I get the same problem using different data sets but different stocks (i.e. daily data). $\endgroup$ Commented Jul 6, 2018 at 8:18
  • $\begingroup$ Thanks! I thought it might have something to do with the scale of your numbers, but scaling doesn't help; already det(cov(scale(foo)[,1:4])) yields -2e-17, although the covariance matrix of these first four columns looks innocuous enough. I'll retract my close vote and upvote. $\endgroup$ Commented Jul 6, 2018 at 8:43
  • $\begingroup$ Just an idea: How have you estimated the risk-free rate you subtracted? If you had estimated the risk-free rate as the average of those stocks (intentionally or due to a program error), you would be getting perfect multicollinearity. $\endgroup$
    – Pere
    Commented Jul 6, 2018 at 10:11
  • $\begingroup$ @Pere The risk-free is a vector that matches the same time series. The operation of the excess returns is simply a matrix that subtracts a vector. On the other hand, I might have found the issue. My time series do not take into accounts holidays, which means that I will have multiple rows with all zeroes, that would automatically make it singular (IIRC). Removing the zero-rows, the determinant is very close to zero, i.e. 2.32e-240. Even though it is not zero, would that be considered as non-zero? $\endgroup$ Commented Jul 6, 2018 at 10:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.