#R_函数#Decompose

decompose {forecast} R Documentation
Classical Seasonal Decomposition by Moving Averages

Description

Decompose a time series into seasonal, trend and irregular components using moving averages. Deals with additive or multiplicative seasonal component.

Usage

decompose(x, type=c("additive", "multiplicative"), filter=NULL)
Arguments

x
A time series.

type
The type of seasonal component. Can be abbreviated.

filter
A vector of filter coefficients in reverse time order (as for AR or MA coefficients), used for filtering out the seasonal component. If NULL, a moving average with symmetric window is performed.

Details

The additive model used is:

Y[t]=T[t] + S[t] + e[t]

The multiplicative model used is:

Y[t]=T[t] * S[t] * e[t]

The function first determines the trend component using a moving average (if filter is NULL, a symmetric window with equal weights is used), and removes it from the time series. Then, the seasonal figure is computed by averaging, for each time unit, over all periods. The seasonal figure is then centered. Finally, the error component is determined by removing trend and seasonal figure (recycled as needed) from the original time series.

Value

An object of class "decomposed.ts" with following components:

seasonal
The seasonal component (i.e., the repeated seasonal figure)

figure
The estimated seasonal figure only

trend
The trend component

random
The remainder part

type
The value of type



#
这个函数,主要用移动平均把趋势分解成季节影响,本身趋势,随机影响三部分。

#ts
> xx<-ts(1:1095,start=c(2011,1,1),frequency=365) #DATA=1:1095;起始时间是2011年1月1日;一年为一个周期
#decompose
> f<-decompose(xx) 
> plot(f)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值