• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

R语言 arima函数

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

 

arima(stats)
arima()所属R语言包:stats

                                        ARIMA Modelling of Time Series
                                         时间序列的ARIMA模型建模

                                       

描述----------Description----------

Fit an ARIMA model to a univariate time series.
适合一个单变量时间序列的ARIMA模型。


用法----------Usage----------


arima(x, order = c(0, 0, 0),
      seasonal = list(order = c(0, 0, 0), period = NA),
      xreg = NULL, include.mean = TRUE,
      transform.pars = TRUE,
      fixed = NULL, init = NULL,
      method = c("CSS-ML", "ML", "CSS"),
      n.cond, optim.method = "BFGS",
      optim.control = list(), kappa = 1e6)



参数----------Arguments----------

参数:x
a univariate time series
单变量的时间序列


参数:order
A specification of the non-seasonal part of the ARIMA model: the three components (p, d, q) are the AR order

, the degree of differencing, and the MA order.
非季节性的ARIMA模型的规范的三个组成部分(p, d, q)是的AR秩序,一定程度的差异,以及马秩序。


参数:seasonal
A specification of the seasonal part of the ARIMA model, plus the period (which defaults to frequency(x)). This

should be a list with components order and period, but a specification of just a numeric vector of length 3 will

be turned into a suitable list with the specification as the order.
一个规范的季节ARIMA模型的一部分,加上期间(默认frequency(x))。这应该是一个组件列表order和period,但只是一个

长度为3的数字向量的规范将到一个合适的名单与order规范。


参数:xreg
Optionally, a vector or matrix of external regressors, which must have the same number of rows as x.
或者,一个向量或矩阵的外部回归,必须有相同数量的行x。


参数:include.mean
Should the ARMA model include a mean/intercept term?  The default is TRUE for undifferenced series, and it

is ignored for ARIMA models with differencing.
ARMA模型应包括平均/截距项?默认的是TRUE非差系列,它是有差异的ARIMA模型忽略。


参数:transform.pars
Logical.  If true, the AR parameters are transformed to ensure that they remain in the region of stationarity.  

Not used for method = "CSS".
逻辑。如果情况属实,AR参数的改变,以确保它们保持在平稳的区域。不习惯method = "CSS"。


参数:fixed
optional numeric vector of the same length as the total number of parameters.  If supplied, only NA entries

in fixed will be varied.  transform.pars = TRUE will be overridden (with a warning) if any AR parameters are

fixed. It may be wise to set transform.pars = FALSE when fixing MA parameters, especially near non-invertibility.  
可选的数字作为参数的总数相同长度的向量。如果提供,仅NA项fixed将各不相同。 transform.pars = TRUE将重写(警告),

如有AR参数是固定的。它可能是明智的设置transform.pars = FALSE固定MA参数时,特别是附近的非可逆性。


参数:init
optional numeric vector of initial parameter values.  Missing values will be filled in, by zeroes except for

regression coefficients.  Values already specified in fixed will be ignored.
可选的数字矢量的初始参数值。失踪的值将被填补,除了回归系数为零。已经fixed指定的值将被忽略。


参数:method
Fitting method: maximum likelihood or minimize conditional sum-of-squares.  The default (unless there are

missing values) is to use conditional-sum-of-squares to find starting values, then maximum likelihood.
拟合方法:最大的可能性或减少有条件的平方的总和。默认(除非有缺失值)使用条件和平方找到初始值,然后最大可能性。


参数:n.cond
Only used if fitting by conditional-sum-of-squares: the number of initial observations to ignore.  It will be

ignored if less than the maximum lag of an AR term.
只用了,如果有条件和最小二乘拟合:忽略了初步意见。它会被忽略,如果小于最大的一个AR长期滞后。


参数:optim.method
The value passed as the method argument to optim.
methodoptim参数传递的值。


参数:optim.control
List of control parameters for optim.
名单optim的控制参数。


参数:kappa
the prior variance (as a multiple of the innovations variance) for the past observations in a differenced model.

  Do not reduce this.
前方差(创新方差的倍数)差分模型在过去的观测。不减少。


Details

详情----------Details----------

Different definitions of ARMA models have different signs for the AR and/or MA coefficients.  The definition used

here has
ARMA模型有不同的定义有不同的AR和/或MA系数的迹象。这里所用的定义有

and so the MA coefficients differ in sign from those of S-PLUS. Further, if include.mean is true (the default for an

ARMA model), this formula applies to X - m rather than X.  For ARIMA models with differencing, the differenced

series follows a zero-mean ARMA model. If am xreg term is included, a linear regression (with a constant term if

include.mean is true and there is no differencing) is fitted with an ARMA model for the error term.
所以马系数不同,S-PLUS标志。此外,如果include.mean是真实的(默认为ARMA模型),该公式适用于X - m而不是X。

ARIMA模型与差异,差分系列如下零平均ARMA模型。如果上午xreg项,线性回归(常数项,如果include.mean是真实而有差异)

与ARMA模型拟合误差项。


The variance matrix of the estimates is found from the Hessian of the log-likelihood, and so may only be a rough guide.
从黑森州的对数似然估计的方差矩阵被发现,所以可能只是一个粗略的指南。

Optimization is done by optim.  It will work best if the columns in xreg are roughly scaled to zero mean and unit

variance, but does attempt to estimate suitable scalings.
优化完成optim。它将工作最好的,如果在列xreg大致缩小到零均值和单位方差,但没有试图估计合适的结垢。


值----------Value----------

A list of class "Arima" with components:
一类"Arima"与组件的列表:


参数:coef
a vector of AR, MA and regression coefficients, which can be extracted by the coef method.
AR,MA和回归系数,可以通过coef方法提取向量。


参数:sigma2
the MLE of the innovations variance.
创新方差MLE。


参数:var.coef
the estimated variance matrix of the coefficients coef, which can be extracted by the vcov method.
系数的估计方差矩阵coef,它可以通过vcov方法提取。


参数:loglik
the maximized log-likelihood (of the differenced data), or the approximation to it used.
最大化日志的可能性(差分数据),或近似的使用。


参数:arma
A compact form of the specification, as a vector giving the number of AR, MA, seasonal AR and seasonal

MA coefficients, plus the period and the number of non-seasonal and seasonal differences.
一个紧凑的形式规范,作为向量提供的AR,MA,季节性AR和季节性马系数,加上期间和非季节性和季节性差异。


参数:aic
the AIC value corresponding to the log-likelihood. Only valid for method = "ML" fits.
AIC值,相应的对数似然。只method = "ML"有效适合。


参数:residuals
the fitted innovations.
拟合的创新。


参数:call
the matched call.
匹配的呼叫。


参数:series
the name of the series x.
名称系列x。


参数:code
the convergence value returned by optim.
收敛值返回optim。


参数:n.cond
the number of initial observations not used in the fitting.
不是在装修中使用的初步意见。


参数:model
A list representing the Kalman Filter used in the fitting.  See KalmanLike.
代表卡尔曼滤波的列表,在装修中使用。看到KalmanLike。


拟合方法----------Fitting methods----------

The exact likelihood is computed via a state-space representation of the ARIMA process, and the innovations

and their variance found by a Kalman filter.  The initialization of the differenced ARMA process uses stationarity

and is based on Gardner et al. (1980).  For a differenced process the non-stationary components are given

a diffuse prior (controlled by kappa).  Observations which are still controlled by the diffuse prior (determined by

having a Kalman gain of at least 1e4) are excluded from the likelihood calculations. (This gives comparable

results to arima0 in the absence of missing values, when the observations excluded are precisely those dropped

by the differencing.)
通过ARIMA过程的状态空间表示,创新和卡尔曼滤波器的方差计算精确的可能性。差的ARMA过程的初始化使用的平稳性和Gardner等。

(1980年)。一个差的过程非平稳组件弥漫事先(控制kappa)。仍然弥漫事先控制的意见(由卡尔曼增益至少1e4)从计算的可能性

排除。 (这使比较的结果arima0缺失值的情况下,排除的意见时,恰恰是那些下跌的差异。)

Missing values are allowed, and are handled exactly in method "ML".
遗漏值是允许的,准确的处理方法"ML"。

If transform.pars is true, the optimization is done using an alternative parametrization which is a variation on

that suggested by Jones (1980) and ensures that the model is stationary.  For an AR(p) model the

parametrization is via the inverse tanh of the partial autocorrelations: the same procedure is applied (separately)

to the AR and seasonal AR terms.  The MA terms are not constrained to be invertible during optimization,

but they will be converted to invertible form after optimization if transform.pars is true.
transform.pars如果是真实的,使用替代参数化,这是由琼斯(1980年)的建议,并确保该模型是静止的变化进行优化。对于

AR(p)模型的参数化是通过反偏自相关的tanh:应用相同的过程(分别)AR和季节性AR条款。马条款没有约束在优化过程中是

可逆的,但他们将被转换后优化transform.pars如果是真正的可逆形式。

Conditional sum-of-squares is provided mainly for expositional purposes.  This computes the sum of squares of

the fitted innovations from observation n.cond on, (where n.cond is at least the maximum lag of an AR term),

treating all earlier innovations to be zero.  Argument n.cond can be used to allow comparability between different fits.

  The "part log-likelihood" is the first term, half the log of the estimated mean square.  Missing values are allowed, but

will cause many of the innovations to be missing.
有条件的总和平方提供主要用于expositional目的。这拟合创新的平方的总和计算,从观察n.cond(其中n.cond至少是最大的一个AR

长期滞后),处理所有早期的创新,是零。参数n.cond可以用来允许不同的配合之间的可比性。 的一部分日志的可能性“是第一个任期

内,有一半的估计均方的日志。遗漏值是允许的,但将导致许多创新的缺失。

When regressors are specified, they are orthogonalized prior to fitting unless any of the coefficients is fixed.  It can be

helpful to roughly scale the regressors to zero mean and unit variance.
当回归是指定的,它们是正交前装修,除非是固定的系数。它可以帮助大致规模回归到零均值和单位方差。


注意----------Note----------

The results are likely to be different from S-PLUS\'s arima.mle, which computes a conditional likelihood and does not

include a mean in the model.  Further, the convention used by arima.mle reverses the signs of the MA coefficients.
其结果很可能是从不同,S-PLUS的arima.mle,计算条件的可能性,不包括在模型中的平均。此外,arima.mle公约反转的MA系数的

迹象。


arima is very similar to arima0 for ARMA models or for differenced models without missing values, but handles

differenced models with missing values exactly. It is somewhat slower than arima0, particularly for seasonally differenced models.
arima很相似arima0ARMA模型或不遗漏值差的模型,但完全处理缺失值的差模型。它比arima0是有点慢,特别是季节性差分模型。


参考文献----------References----------

Series and Forecasting. Springer, New York. Sections 3.3 and 8.3.
State Space Methods.  Oxford University Press.
AS154. An algorithm for exact maximum likelihood estimation of autoregressive-moving average models by means of Kalman

filtering. Applied Statistics 29, 311–322.


2nd Edition, Harvester Wheatsheaf, sections 3.3 and 4.4.
series with missing observations. Technometrics 20 389–395.
R News, 2/2, 2–7. http://www.r-project.org/doc/Rnews/Rnews_2002-2.pdf

参见----------See Also----------

predict.Arima, arima.sim for simulating from an ARIMA model, tsdiag, arima0, ar
predict.Arima,arima.sim模拟ARIMA模型,tsdiag,arima0,ar


举例----------Examples----------


arima(lh, order = c(1,0,0))
arima(lh, order = c(3,0,0))
arima(lh, order = c(1,0,1))

arima(lh, order = c(3,0,0), method = "CSS")

arima(USAccDeaths, order = c(0,1,1), seasonal = list(order=c(0,1,1)))
arima(USAccDeaths, order = c(0,1,1), seasonal = list(order=c(0,1,1)),
      method = "CSS") # drops first 13 observations.[降至第一个13意见。]
# for a model with as few years as this, we want full ML[一个模型,因为这几年,我们要充分的ML]

arima(LakeHuron, order = c(2,0,0), xreg = time(LakeHuron)-1920)

## presidents contains NAs[#总统包含定居]
## graphs in example(acf) suggest order 1 or 3[#例如图(ACF)建议1阶或3]
require(graphics)
(fit1 <- arima(presidents, c(1, 0, 0)))
tsdiag(fit1)
(fit3 &lt;- arima(presidents, c(3, 0, 0)))  # smaller AIC[较小的工商行政管理机关]
tsdiag(fit3)


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
R语言学习笔记之九发布时间:2022-07-18
下一篇:
R语言生存分析 Cox回归模型survival analysis(比例风险模型)发布时间:2022-07-18
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap