## EViews.com

EViews User Forum

## Near Singular Matrix Error

### Near Singular Matrix Error

Post by **corbinm** » Wed Feb 05, 2014 4:11 am

I am having an issue using e views 8 student version. I am getting the typical near singular matrix error and so far I have been un able to find a solution. The regression I am attempting to run is

excess1 c shortint instiown monthd quarterd yeard shortint*monthd shortint*quarterd shortint*yeard excess0 excess0*monthd excess0*quarterd excess0*yeard excess0*shortint excess0*monthd*shortint excess0*quarterd*shortint excess0*yeard*shortint

This is one of three equations which all include similar variables and has been successfully run on several other country data sets I am testing. However for some reason I run into this problem only on my Indonesia data set and one other data set our of over 60. I’ve tried removing the constant variable and that has done nothing. I need to include all other variables and so I can’t afford to start deleting variables here and there.

Just for reference the dummy variables are monthd quarterd and yeard which indicate different period ends,i.e a month end quarter end or year end date. and there is no over lap, so the last date in jan and feb will have a 1 for month end while the end of march with have a 1 for quarter end but a zero for month end and so on

Any help would be great, Ive attached the .txt file below which im using as my data in e views

### Re: Near Singular Matrix Error

Post by **trubador** » Wed Feb 05, 2014 5:33 am

### Re: Near Singular Matrix Error

Post by **corbinm** » Wed Feb 05, 2014 7:01 am

I see, thank you for your help with that. I am still relatively new to e views and very rusty on my econmetrics. Could you explain the commands for determining this issue as I have a couple other equations which are presenting a similar issue? Further more does this suggest an issue with my data or is it a matter of chance probability that this occurred for the variables in this data set while numerous other identical ones (for other countries) did not run in to this problem?

Thanks again for you quick response and help

### Re: Near Singular Matrix Error

Post by **trubador** » Wed Feb 05, 2014 7:52 am

### Re: Near Singular Matrix Error

Post by **Marcel Visser** » Mon May 18, 2015 3:59 am

I am receiving the same error code. I attached my original correlation matrix. Even when I do not include the variables for Financial Development and Profitability in the regression I still get the error code.

Does anyone know what I am doing wrong and how i will be able to fix this?

Thanks in advance.

### Re: Near Singular Matrix Error

Post by **EViews Gareth** » Mon May 18, 2015 7:56 am

### Re: Near Singular Matrix Error

Post by **Marcel Visser** » Mon May 18, 2015 9:01 am

I found the problem. My variable OPRISK takes the same value for any company year observation in the sample, 2008-2012. So the value only varies when companies change, not when years change. I found somewhere else on this forum that this prevents you from running a cross section fixed effects regression. The regression I try to run is Leverage ratio= c (Financial development) (Inflation) (Marginal tax rate) (OPRISK) (log sales) (profitability) (tangibility). Can I just remove the variable OPRISK and run the regression. Will this accurately remove the year and section effects from the other variables? Because I still need to control for the year and section effects on the other variables. My sample size is very large, 122000 observations per variable. Therefor I cannot upload my file. The thing is i ran a Hausman test which told me to use a fixed effect model. However, the OPRISK variable prevents me from doing this. The book Introductory econometrics for finance also said that you could use a slightly modified version of the Chow test to check if a panel regression was really necessary. It said in some cases you could just pool the data and preform a regular OLS.

If i will not be able to exclude the year and section effects with a fixed effects panel regression, should i then use this approach. And could you please tell me how this is done?

I would like to thank you in advance for your time.

Kind regards,

Marcel Visser

### Re: Near Singular Matrix Error

Post by **said.abouabdo** » Wed Apr 04, 2018 6:58 am

### Re: Near Singular Matrix Error

Post by **startz** » Wed Apr 04, 2018 8:57 am

### Re: Near Singular Matrix Error

Post by **Alina03** » Sat Jul 14, 2018 5:59 am

### Re: Near Singular Matrix Error

Post by **startz** » Sat Jul 14, 2018 6:50 am

## EViews.com

EViews User Forum

## Near Singular Matrix Error

### Near Singular Matrix Error

Post by **u01uw11** » Tue Mar 10, 2015 7:06 am

First off, I’m not entirely sure if this is the correct subforum to post this; if it isn’t, I apologize.

I’m also a newcomer to both EViews and this forum, so please be gentle .

I use EViews 7.

I’m trying to estimate the effects of women on the board (binarywomen= (0,1)) an interaction term (binarywomen*logii), where logii= log(innovationintensity), where innovationintensity= R&D expenditure/total assets.

I use a few control variables, such as log(innovationintensity), log(size), age, leverage, log(capexintensity), log(agecapitalstock), and board size.

I have unbalanced (incomplete) panel data for all FTSE100 companies over the period 1993-2013.

I can estimate the regression with EITHER cross-section fixed effects (which would translate into firm fixed effects) OR period fixed effects (which would be Year fixed effects), however, when I try to do both together I get the error message «Near Singular Matrix».

I have looked through the forums and apparently this error message pops up when there are issues of multicollinearity, but can’t figure out where this would be the case in my data.

I have also modelled the year dummy variables myself, and used cross-section fixed effects in eviews, but I still get the same error message.

I attached my excel file with the panel data, and the EViews workfile with the final dependent and independent variables.

The model should look like this:

logtobinq c logii logsize age leverage logcei logacs boardsize binarywomen bwlogii yr1 yr2 yr3 yr4 yr5 yr6 yr7 yr8 yr9 yr10 yr11 yr12 yr13 yr14 yr15 yr16 yr17 yr18 yr19 yr20

and using cross-section fixed effects with this regression, I get the error message «Near Singular Matrix».

Any suggestions how I can resolve this?

(PS: If I only use cross-section fixed effects EViews can use 499 observations over 13 periods and 49 cross-sections.)

## EViews.com

EViews User Forum

## Near Singular Matrix Error for Impulse response fonctions

### Near Singular Matrix Error for Impulse response fonctions

Post by **sivakizildag** » Fri Nov 18, 2016 10:02 am

In order to analyse the interactions between the following data, I made an SVAR:

— tourist arrivals in France —> A_TOT_SA

— accomodation capacity in number of rooms in hotels (in first difference) —> D(OFF_SA)

— a consumer confidence index for OECD countries —> D(E_OECD)

There is one last dummy variable for the Paris terror attacks (EVENT_ATT_NOV_15).

With these variables, I make the SVAR (SVAR):

1. I estimate the VAR with 4 lags (results in TABLE01)

2. Using matrixes ZA and ZB, I make the VAR and SVAR (results in TABLE02)

When I ask Eviews for the IRF, I get an **Error Message: «Near singular matrix».**

I aso installed the sirf add-in for scaled IRFs, I also get the same message.

One last things that might help: on the IRF menu, when I switch the **Analytic (asymptotic)** to **None** in the Response Standard Errors section, I get the IRFs but without the confidence intervals. Could you please tell me why this is happening?

Thank you very much,

### Re: Near Singular Matrix Error for Impulse response fonctions

Post by **EViews Matt** » Fri Nov 18, 2016 4:12 pm

Let me address your questions in reverse order. First, regarding the missing confidence intervals when you select the «None» option under «Response Standard Errors». The confidence interval presentation make use of the standard errors, so if you choose to omit the standard errors then the confidence intervals are omitted too.

Second, regarding the near singular matrix error when you select the «Analytic (asymptotic)» option under «Response Standard Errors». One of the intermediate calculations performed behind the scenes is the second moment matrix of the VAR regressors, which is then inverted. Unfortunately, for your data that moment matrix is ill-conditioned (the estimated condition number is on the order of 10^18). EViews detects that the moment matrix is near singular and cannot be safely inverted, producing the error you experienced. From a numerical perspective, the problem seems to arise from the large magnitude of your first endogenous variable (a_tot_sa).

### Re: Near Singular Matrix Error for Impulse response fonctions

Post by **sivakizildag** » Mon Nov 21, 2016 9:58 am

Thanks you so much!

Indeed, it works now that I took the first difference with logarithms!

### Re: Near Singular Matrix Error for Impulse response fonctions

Post by **sivakizildag** » Fri Nov 25, 2016 5:00 am

I have another question, about the LR restrictions:

In the SVAR, what are the coefficients estimated in the long-run pattern matrix?

I mean, there is the formula on top: Model: Ae = Bu where E[uu’]=I

Down below we have the estimated A and B matrixes.

So what are the coefficients C(1) to C(5)

### Re: Near Singular Matrix Error for Impulse response fonctions

Post by **EViews Matt** » Mon Nov 28, 2016 11:44 am

It would probably help to review the relevant section of the SVAR documentation, but the short answer is the following relation:

where C is the long-term factorization matrix (the one you specify the pattern for and contains the coefficients), Ψ is the vector moving average matrix, and A and B are the two factorization matrices you’re already familiar with. In order to solve this equation EViews assumes that A = I, so the solution will come in the form of B = Ψ^-1 * C.

## EViews.com

EViews User Forum

## Near Singular Matrix

### Near Singular Matrix

Post by **sawaviews** » Tue Sep 11, 2012 1:18 am

I am attempting to build a VECm and have tested all the variables for uroot and then created a VAR. Upon doing so, I then went to test for the appropriate lag length. I tried to run the test with the lag length criteria as 2, but I received the error «near singular matrix» — how do i rectify this? When i test with 1 lag it does not return this error however if i use one lag i am then unable to run the cointegration test as I am informed that I have insufficient observations (which stands at 39 prior to the cointegration test).

Kindly advise of what is happening and how i can rectify it — my econometrics knowledge was fairly basic to begin with and is now rusty!

### Re: Near Singular Matrix

Post by **EViews Gareth** » Tue Sep 11, 2012 7:50 am

### Near Singular Matrix error

Post by **rajiv** » Sun Sep 16, 2012 5:41 pm

Hi Gareth,

I have a data set of about 500 text files that are forecast numbers for various products. (one file is one product) I have written an eviews program that opens each of these files, runs approximately 24 regressions on each file and prints out the results for these products in a single file. so far so good.

My problem is that I am hitting the near singular matrix error for some data sets. This error is because some of the data sets have perfectly colinear variables.

Can i write code to skip running a particular regression if the data is perfectly colinear?

Is there a way for me to check for these errors in my script. right now the problem is that when i define my equation itself i get the following error : Near singular matrix error. Regressors may be perfectly colinear in «EQUATION EQ6.LS Y C T T^2 Q1 Q2 Q3 Y(-1)»

here is a snippet of the program :

subroutine equation_6(scalar outlier_present, scalar quartertoforecast)

‘ Create an Equation

equation eq6.ls y c t t^2 q1 q2 q3 y(-1) outlier

‘Getting an error on this line itself, need to check fo the singular matrix error before defining the equation itself

string dummy = «Results for Equation 6 : y c t t^2 q1 q2 q3 y(-1) outlier»

## EViews.com

EViews User Forum

## Near singular matrix

### Near singular matrix

Post by **Ydwolf** » Fri Oct 07, 2011 3:56 am

For my thesis, I am researching the influence of terrorism on financial markets. Thereby, I study 68 different countries, for which I have written a simple program to generate the same regression for all of these countries. But for some reason, I get the error «Near singular matrix» only for country60(which is Switzerland), although I don’t see any difference in the data or the dummies used. In attachement you can find the workfile and program, just for country60. Can someone please tell me what the problem could be? If it would help, I can also upload the data for all 68 countries. Thank you very much,

### Re: Near singular matrix

Post by **EViews Glenn** » Fri Oct 07, 2011 9:29 am

### Re: Near singular matrix

Post by **Ydwolf** » Sat Oct 08, 2011 1:29 am

And what can I do to solve this? I’m not a real expert in EViews, you see.

### Re: Near singular matrix

Post by **EViews Gareth** » Sat Oct 08, 2011 11:27 am

### Re: Near singular matrix

Post by **lnp3** » Sat Oct 08, 2011 3:33 pm

well, isn’t the solution «exclude variables that are multi-collinear and re-estimate with different variables»?

### Re: Near singular matrix

Post by **startz** » Sat Oct 08, 2011 8:12 pm

### Re: Near singular matrix

Post by **lnp3** » Sun Oct 09, 2011 8:51 am

Dear Eviews expert,

Thank you so much for your answer on near singular matrix. I am currently using Eviews 5.1 but will install 7 soon. Can you also help me with this warning? When I run hausman test to determine fixed or random effects estimator, I get this warning.

What should I do to filter the problem? Since Hausman test probability (0.68) is larger than critical value (0.05), it is appropriate estimate with random effect (as I was told, if test value

### Re: Near singular matrix

Post by **vtodorov** » Thu Nov 08, 2012 5:13 am

lnp3 wrote: Dear Eviews expert,

Thank you so much for your answer on near singular matrix. I am currently using Eviews 5.1 but will install 7 soon. Can you also help me with this warning? When I run hausman test to determine fixed or random effects estimator, I get this warning.

What should I do to filter the problem? Since Hausman test probability (0.68) is larger than critical value (0.05), it is appropriate estimate with random effect (as I was told, if test value

### Re: Near singular matrix

Post by **Rosa.hh** » Tue Nov 27, 2012 9:43 am

Dear eviews experts,

Thanks fo the usefull information provided previously. I still have some questions.

I am running an egarch model to determinate the volatility of an interest rate and I would like to include specific events dummies (I am using daily data and eviews 7). However, I am having a multicolinearity problem.

I am not very used to eviews and would like to learn more. I have checked the correlogram matrix and vif in stata and they dont show a problem with my event variables(see results below). However when using eviews and regressing my dependent variables on the events, a problem of multicollinearity appears to exist (message «near singular matrix»). I also tried dropping the constant or one of the dummies, but the problem continues.

I also have calculated the correlation matrix of my event variables in eviews and a problem is pointed out as I get NA as result.

I enclose my workfile.

Would anyone help me understand:

1) Is the multicollinearity problem also related related to the fact that my event dummies are almost always zero, and only 1 for a few observations (7, 5 & 168 obs out of a total of 3425) ?

2) why I do I get NA when calculating the correlation matrix?

Thanks a lot for your help!

Here are results on VIF correlogram matrix (from stata):

. correlate ev_1 ev_3 ev_0510

(obs=3425)

| ev_1 ev_3 ev_0510

————-+—————————

ev_1 | 1.0000

ev_3 | -0.0017 1.0000

ev_0510 | -0.0103 0.1684 1.0000