全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1664 2
2013-05-24
本人新手,看SPSS 里面ARIMA支持包含多个自变量的情况,没有查到R ARIMA 里面相关说明?有人用过吗?求大侠解答~~~
二维码

扫码加我 拉你入群

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

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

全部回复
2013-5-26 03:51:57
Yes. Here is an example. The true data is simulated as

data t1;
  err0=0;
  do i=-100 to 1000;
    x=rannor(123);
        err=0.7*err0+rannor(123);
    y=2+0.8*x+err;
        if i>=1 then output;
        err0=err;
   end;
   keep x y;
run;

The intercept is 2 and coef. of x is 0.8 and ar of error is 0.7. And z is a noise variable added to illustrate it supported multiple x-variables.  

simudata<- read.csv("c:\\temp\\test.csv");
y<- simudata$y
x<- simudata$x
z<- rnorm(length(simudata$x))
xreg=cbind(x,z)

arima(y, order = c(1,0,0), xreg = x)
arima(y, order = c(1,0,0), xreg = xreg)

*********************
Call:
arima(x = y, order = c(1, 0, 0), xreg = x)

Coefficients:
         ar1  intercept       x
      0.6592     1.8110  0.7897
s.e.  0.0237     0.0918  0.0278

sigma^2 estimated as 0.9822:  log likelihood = -1410.27,  aic = 2828.54
> arima(y, order = c(1,0,0), xreg = xreg)

Call:
arima(x = y, order = c(1, 0, 0), xreg = xreg)

Coefficients:
         ar1  intercept       x        z
      0.6595     1.8098  0.7895  -0.0174
s.e.  0.0237     0.0919  0.0278   0.0268

sigma^2 estimated as 0.9818:  log likelihood = -1410.06,  aic = 2830.12
二维码

扫码加我 拉你入群

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

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

2013-7-10 17:31:33
多谢~~
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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