楼主: laoshuaituzi
6594 5

[问答] 求教用R写ARMA的生产程序? [推广有奖]

  • 1关注
  • 0粉丝

小学生

57%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
106 点
帖子
4
精华
0
在线时间
8 小时
注册时间
2011-4-11
最后登录
2012-5-3

楼主
laoshuaituzi 发表于 2011-4-11 17:13:44 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
用R写ARMA模型的生成程序的语言怎样写,望高手举个例子谢谢
二维码

扫码加我 拉你入群

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

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

关键词:ARMA ARM RMA arma模型 MA模型 程序 ARMA 求教 生产

回帖推荐

beatuxlee 发表于5楼  查看完整内容

library(tseries) x

楚韵荆风 发表于3楼  查看完整内容

如果产生MA或AR也还有其他的方法,比如 w=rnorm(500,0,1) # 500 N(0,1) variates v=filter(w,sides=2,rep(1/3,3)) # moving average v(t)=(w(t+1)+w(t)+w(t-1))/3 par(mfrow=c(2,1)) plot.ts(w,main="white noise") plot.ts(v,ylim=c(-3,3), main="moving average") 以及: w = rnorm(550,0,1) # 50 extra to ...

beatuxlee 发表于2楼  查看完整内容

> library(tseries) > x arma(x) Call: arma(x = x) Coefficient(s): ar1 ma1 intercept 0.32929 0.31320 0.01793

本帖被以下文库推荐

沙发
beatuxlee 发表于 2011-4-14 17:43:41
> library(tseries)
> x <- arima.sim(n = 63, list(ar = c(0.8897, -0.4858), ma = c(-0.2279, 0.2488)),
+           sd = sqrt(0.1796))
> arma(x)

Call:
arma(x = x)

Coefficient(s):
      ar1        ma1  intercept  
  0.32929    0.31320    0.01793
已有 1 人评分论坛币 热心指数 收起 理由
yahoocom + 20 + 1 鼓励积极发帖讨论

总评分: 论坛币 + 20  热心指数 + 1   查看全部评分

无为有之始

藤椅
楚韵荆风 学生认证  发表于 2011-4-14 18:28:56
如果产生MA或AR也还有其他的方法,比如
w=rnorm(500,0,1)                                              # 500 N(0,1) variates
v=filter(w,sides=2,rep(1/3,3))                          # moving average v(t)=(w(t+1)+w(t)+w(t-1))/3
par(mfrow=c(2,1))
plot.ts(w,main="white noise")
plot.ts(v,ylim=c(-3,3), main="moving average")
以及:
w = rnorm(550,0,1)                                      # 50 extra to avoid startup problems
x = filter(w, filter=c(1,-.9), method="recursive")[-(1:50)] #x[3]==x[2]-0.9*x[1]+w[53]
plot.ts(x, main="autoregression")
共享是一种彼此的快乐

板凳
cescelia 在职认证  发表于 2011-4-16 10:52:55
用R来确定arma的p,q值呢

报纸
beatuxlee 发表于 2011-4-16 17:58:45
library(tseries)
x <- arima.sim(n = 63, list(ar = c(0.8897, -0.4858), ma = c(-0.2279, 0.2488)),
          sd = sqrt(0.1796))
ARMA.Order <- function(x,max) {
  armax <- mamax <- max
  require(foreach)
  armafit <- function(x,a,b){
    res.arma <- arma(x,order=c(a,b))
    summary(res.arma)$aic
  }
  res.aic <- foreach(a=1:armax,.combine="rbind") %:% foreach(b=1:mamax,.combine="rbind") %do% {
    aic <- armafit(x,a,b)
    cbind(aic,a,b)
  }
  out <- res.aic[which.max(res.aic[,1]),]
  cat("最大 AIC 是",out[1],"\n AR 阶是",out[2],"\n MA 阶是",out[3],"\n")
  a <- out[2];b <- out[3]
  cat("a =",a,"b =",b,"\n")
  arma.maxaic <- arma(x,order=c(a,b))
  return(arma.maxaic)
}
ARMA.Order(x,max=3)



最大 AIC 是 63.0571
AR 阶是 1
MA 阶是 1
a = 1 b = 1

Call:
arma(x = x, order = c(a, b))

Coefficient(s):
      ar1        ma1  intercept  
  0.41560    0.20058   -0.07382  

警告信息:
1: In arma(x, order = c(a, b)) : Hessian negative-semidefinite
2: In sqrt(diag(object$vcov)) : 产生了NaNs
3: In sqrt(diag(object$vcov)) : 产生了NaNs
无为有之始

地板
sigmund 在职认证  发表于 2011-4-17 02:09:43
学习了!不错!

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-19 12:45