全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
2537 1
2010-10-08
请牛人指点,为什么我在运行下面的程序时会出现以下问题:
> #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
>
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2015-2-4 18:02:36
这是因为你的X是奇异矩阵,做不出来
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群