Page 1 of 1

Near singular matrix..

Posted: Sat May 03, 2014 1:27 am
by Kohei
When I try following rolling regression, eviews 8 gives me "Near singular matrix in "VAR VAR1A!IA!Y.LS(NOCONST) 0 0 DRM4 @ RMM4*P4A1 RMM4*M4A1" :(

Code: Select all

for !i=1 to 413 smpl @first+!i-1 @first+98+!i '産出価格と投入価格のOLS equation b!i.ls value c soy '残差の変数作成 b!i.makeresid rm!i delete b!i Series rmm!i=rm!i(-1) Series drm!i=d(rm!i) '残差をベクトルにして並び替える stom(rm!i, vrm!i) vector srm!i=@sort(vrm!i) delete vrm!i rm!i '並び変えたベクトルをシリーズに mtos(srm!i, ssrm!i) delete srm!i '推計 for !y=1 to 70 for !j=16+!i-1 to 85+!i-1 genr p!ia!y=drm!i(-1)>=@elem(ssrm!i, !j) genr m!ia!y=drm!i(-1)<@elem(ssrm!i,!j) if !j=!y+!i+14 then exitloop endif next 'ラグ次数0 var var1a!ia!y.ls(noconst) 0 0 drm!i @ rmm!i*p!ia!y rmm!i*m!ia!y equation eq1a!ia!y.ls drm!i rmm!i*p!ia!y rmm!i*m!ia!y 'ssrのスカラー作成 scalar ssr1a!ia!y=var1a!ia!y.@ssr(1) 'q統計量 freeze(q1a!ia!y) var1a!ia!y.qstats(6) scalar qq1a!ia!y=@val(q1a!ia!y(14,2)) delete q1a!ia!y '係数スカラーの作成 vector vec1a!ia!y=@vec(var1a!ia!y.@coefmat) scalar c1a!ia!y=vec1a!ia!y(1) scalar d1a!ia!y=vec1a!ia!y(2) delete vec1a!ia!y '選別 If c1a!ia!y<1 and d1a!ia!y<1 and (1+c1a!ia!y)*(1+d1a!ia!y)<1 and qq1a!ia!y<10.645 then ssr1a!ia!y=ssr1a!ia!y else ssr1a!ia!y=100 endif delete c1a!ia!y d1a!ia!y 'ssrの最小値の場所 vector(70) ssr1a!i vector ssr1a!i(!y)=ssr1a!ia!y delete ssr1a!ia!y scalar iid1a!i=@imin(ssr1a!i) next next
Is there any method to avoid this error??
Thanks in advance m(_ _)m

Kohei

Re: Near singular matrix..

Posted: Sat May 03, 2014 6:38 am
by EViews Gareth
You have no lags in your VAR

Re: Near singular matrix..

Posted: Sat May 03, 2014 7:15 am
by Kohei
Thanks for reply :)

Already, I calculated various lags of var and I put the above 0 lags code as the sample to explain my circumstances.
On lags 1 or 2 or 3..., there are same problems, near singular matrix..
Thanks.

Kohei

Re: Near singular matrix..

Posted: Sat May 03, 2014 8:00 am
by EViews Gareth
You probably have perfect collinearity

Re: Near singular matrix..

Posted: Sat May 03, 2014 8:11 am
by Kohei
I see.. :roll:
Thank you very much.

Re: Near singular matrix..

Posted: Sat May 03, 2014 8:29 am
by startz
Sine your explanatory variables are RMM4*P4A1 RMM4*M4A1, see if P4A1 and M4A1 are the same for your sample. Since your sample is in a loop you might use the same program and just do ls c RMM4*P4A1 RMM4*M4A1 to see if you get an error.