English 中文(简体)
1. 时间序列模型
原标题:Time series modelling with irregular data

I m目前正在开展一个pet项目,从历史基础石油价格中预测未来基油价格。 数据是每周的,但在缺乏价格之间有一段时间。

我对带有完整数据的模拟时间序列稍感怀疑,但在涉及非正常数据时,我所学习的模式可能不适用。 我是否以通常的方式使用xts类并采用ARIMA模式?

在建立预测未来价格的模式之后,我想将原油价格的波动、柴油利润率、汽车销售、经济增长等因素考虑在内,以便提高准确性。 难道有人能够说明我如何有效地这样做? 我认为,它喜欢一个马奇。

EDIT: Trimmed Data here: https://docs.google.com/document/d/18pt4ulTpaVWQhVKn9XJHhQjvKwNI9uQystLL4WYinrY/edit

编码:

Mod.fit<-arima(Y,order =c(3,2,6), method ="ML")

结果: Warning message: In log(s2) : NaNs produced

这一警告是否会影响我的模型准确性?

在缺乏数据的情况下,我可以使用ACF和PACF。 是否有更好的选择模式? 我利用AIC(Akaike s Information Criterion)来比较使用该守则的不同ARIMA模式。 ARIMA(3,2,6)给最小的阿拉伯工业公司。

编码:

AIC<-matrix(0,6,6)
for(p in 0:5)
for(q in 0:5)
{
mod.fit<-arima(Y,order=c(p,2,q))
AIC[p+1,q+1]<-mod.fit$aic
p
}
AIC

结果:

              [,1]     [,2]     [,3]     [,4]     [,5]     [,6] 
    [1,] 1396.913 1328.481 1327.896 1328.350 1326.057 1325.063 
    [2,] 1343.925 1326.862 1328.321 1328.644 1325.239 1318.282 
    [3,] 1334.642 1328.013 1330.005 1327.304 1326.882 1314.239 
    [4,] 1336.393 1329.954 1324.114 1322.136 1323.567 1316.150 
    [5,] 1319.137 1321.030 1320.575 1321.287 1323.750 1316.815 
    [6,] 1321.135 1322.634 1320.115 1323.670 1325.649 1318.015
问题回答

总的来说,你不需要使用xts,然后才需要一个额外的步骤。 记录为NA的缺失数值通过arima(处理,如果使用method = “ML>,则将予以确切处理;其他方法可能无法得到关于缺失数据的创新。 这是因为arima()符合ARIMA模式的国家空间代表制。

如果数据是正常的,但缺乏数据,则上述数据应予罚款。

我不说一般使用xts的理由是,arima(<>>/code>作为投入需要一个固定时间序列物体?ts。 但是,xts > 延伸和继承来自o 物体和 包裹does <>m> > 提供<条码>s>。 因此,如果你将数据输入zoo(>或xts(> Object,那么你可以强制将ts”>,其中应当包括NA在适当地点,arima(<>>>,如果能够(即有太多的缺失值)的话,将予以处理。





相关问题
How to plot fitted model over observed time series

This is a really really simple question to which I seem to be entirely unable to get a solution. I would like to do a scatter plot of an observed time series in R, and over this I want to plot the ...

REvolution for R

since the latest Ubuntu release (karmic koala), I noticed that the internal R package advertises on start-up the REvolution package. It seems to be a library collection for high-performance matrix ...

R - capturing elements of R output into text files

I am trying to run an analysis by invoking R through the command line as follows: R --no-save < SampleProgram.R > SampleProgram.opt For example, consider the simple R program below: mydata =...

R statistical package: wrapping GOFrame objects

I m trying to generate GOFrame objects to generate a gene ontology mapping in R for unsupported organisms (see http://www.bioconductor.org/packages/release/bioc/vignettes/GOstats/inst/doc/...

Changing the order of dodged bars in ggplot2 barplot

I have a dataframe df.all and I m plotting it in a bar plot with ggplot2 using the code below. I d like to make it so that the order of the dodged bars is flipped. That is, so that the bars labeled "...

Strange error when using sparse matrices and glmnet

I m getting a weird error when training a glmnet regression. invalid class "dgCMatrix" object: length(Dimnames[[2]]) must match Dim[2] It only happens occasionally, and perhaps only under larger ...

Generating non-duplicate combination pairs in R

Sorry for the non-descriptive title but I don t know whether there s a word for what I m trying to achieve. Let s assume that I have a list of names of different classes like c( 1 , 2 , 3 , 4 ) ...

Per panel smoothing in ggplot2

I m plotting a group of curves, using facet in ggplot2. I d like to have a smoother applied to plots where there are enough points to smooth, but not on plots with very few points. In particular I d ...