请教会用R来分析time series的MM

s
sleeping
楼主 (北美华人网)
我想计算ACF, PACF的standard error, R有自带的命令吗,还是需要我把公式编进去呢
如果要编公式还要循环呢,因为我要计算很多个lag的ACF standard error
 
谢谢~
[此贴子已经被作者于2010/2/8 9:26:56编辑过]
W
Waterleaf
2 楼
http://www.stat.pitt.edu/stoffer/tsa2/R_time_series_quick_fix.htm

没用过这个package,但是online有很多tutorial的~
s
sleeping
3 楼
以下是引用Waterleaf在2/8/2010 9:38:00 AM的发言:
http://www.stat.pitt.edu/stoffer/tsa2/R_time_series_quick_fix.htm 没用过这个package,但是online有很多tutorial的~
谢谢MM, 我也看了这个,不过只找到了怎么计算ACF, PACF,没有找到怎么计算它们的SE. 放狗搜也没搜到
c
canyon
4 楼
以下是引用sleeping在2/8/2010 9:26:00 AM的发言:

我想计算ACF, PACF的standard error, R有自带的命令吗,还是需要我把公式编进去呢
如果要编公式还要循环呢,因为我要计算很多个lag的ACF standard error
 
谢谢~
[此贴子已经被作者于2010/2/8 9:26:56编辑过] do you mean MSE?
s
sleeping
5 楼
以下是引用canyon在2/8/2010 9:54:00 AM的发言:
do you mean MSE?
no, just the standard error of sample ACF
W
Waterleaf
6 楼
以下是引用sleeping在2/8/2010 9:50:00 AM的发言:

谢谢MM, 我也看了这个,不过只找到了怎么计算ACF, PACF,没有找到怎么计算它们的SE. 放狗搜也没搜到
还是那句没用过哈,我看了看那个tutorial,貌似regression的结果应该包括standard error (residuals),see below, maybe you can do summary()。再不行…… 你算the fitted value and diff with the original values。
 
If you want to inspect the residuals, for example, they're in dog$time.series[,3], the third column of the resulting series (the seasonal and trend components are in columns 1 and 2). Check out the ACF of the residuals, acf(dog$time.series[,3]); the residuals aren't white- not even close. You can do a little (very little) better using a local seasonal window, plot(dog <- stl(log(jj), s.win=4)), as opposed to the global one used by specifying "per". Type ?stl for details. There's also something called StructTS that will fit parametric structural models. We don't use these functions in the text when we present structural modeling in Chapter 6 because we prefer to use our own programs.
 
This is a good time to explain $. In the above, dog is an object containing a bunch of things (technical term). If you type dog, you'll see the components, and if you type summary(dog) you'll get a little summary of the results. One of the components of dog is time.series, which contains the resulting series (seasonal, trend, remainder). To see this component of the object dog, you type dog$time.series (and you'll see 3 series, the last of which contains the residuals). And that's the story of $ ... you'll see more examples as we move along.
s
sleeping
7 楼
以下是引用Waterleaf在2/8/2010 10:19:00 AM的发言:

还是那句没用过哈,我看了看那个tutorial,貌似regression的结果应该包括standard error (residuals),see below, maybe you can do summary()。再不行…… 你算the fitted value and diff with the original values。
 
If you want to inspect the residuals, for example, they're in dog$time.series[,3], the third column of the resulting series (the seasonal and trend components are in columns 1 and 2). Check out the ACF of the residuals, acf(dog$time.series[,3]); the residuals aren't white- not even close. You can do a little (very little) better using a local seasonal window, plot(dog <- stl(log(jj), s.win=4)), as opposed to the global one used by specifying "per". Type ?stl for details. There's also something called StructTS that will fit parametric structural models. We don't use these functions in the text when we present structural modeling in Chapter 6 because we prefer to use our own programs.
 
This is a good time to explain $. In the above, dog is an object containing a bunch of things (technical term). If you type dog, you'll see the components, and if you type summary(dog) you'll get a little summary of the results. One of the components of dog is time.series, which contains the resulting series (seasonal, trend, remainder). To see this component of the object dog, you type dog$time.series (and you'll see 3 series, the last of which contains the residuals). And that's the story of $ ... you'll see more examples as we move along.


MM真热心,谢谢MM. 可是我要计算的是ACF的se,好像和residual的se关系不大啊。我直接用了acf(data)这个命令来计算acf,也没有regression,而且这个se不是一个值,而是针对每一个time series lag就出现一个se。不知道我解释清楚没有,我也才学time series,自己也很糊涂。。。刚刚用excel表格输入公式算出来了。。。。/大汗的小猴子/
准备去问问老师