请牛人指点,为什么我在运行下面的程序时会出现以下问题:
> #file name: y.xls
> class(y)
[1] "data.frame"
> names(y)
[1] "x"
> x
NULL
> x=y$x
> x
[1] 127.4 128.4 127.1 126.6 124.8 122.8 119.4 115.3 111.5 108.6 107.4 106.6
[13] 104.3 104.4 103.4 103.2 102.7 101.1 101.1 102.5 102.9 103.1 103.7 104.3
[25] 102.2 101.0 101.6 101.3 103.6 104.4 104.7 104.9 104.5 104.8 104.4 104.5
[37] 105.5 105.3 105.3 107.1 104.7 104.8 105.2 105.8 107.5 107.9 108.2 108.8
> module(finmetrics)
> nonlinearTest(x, method="STAR-LM", p=2, d=1:2)
Problem in solve.qr(a, b): apparently singular matrix
Use traceback() to see the call stack
> nonlinearTest(log(x), method="STAR-LM", p=2, d=1:2)
Problem in solve.qr(a, b): apparently singular matrix
Use traceback() to see the call stack
>
但是这个程序却可以很顺利的运行:
>
> module(finmetrics)
> ndx.ret2 = getReturns(ndx.dat[,"Close"])^2
> ndx.rvol = sqrt(aggregate(ndx.ret2, FUN=sum, by="weeks",week.align=1))
> nonlinearTest(log(ndx.rvol), method="STAR-LM", p=2, d=1:2)
Nonlinearity Test: STAR Nonlinearity
Null Hypothesis: no smooth threshold nonlinearity
Under Maintained Assumption of Homoskedastic Errors --
ChiSq-stat ChiSq-dof ChiSq.pv-val F-stat F-dof F.pv-val
Close.lag1 21.3008 6 0.0016 3.7068 (6,291) 0.0014
Close.lag2 13.6974 6 0.0332 2.3204 (6,291) 0.0333
>