简体   繁体   English

时间序列建模

[英]Time series modeling

I have a dependent variable (target) which looks like this: This is daily data of exchange rate of EUR/USD. 我有一个因变量(目标),看起来像这样:这是EUR / USD汇率的每日数据。

ExchangeDate | ExchangeRate   
2012-01-01   |   0.772484   
2012-01-02   |   0.773471   
2012-01-03   |   0.766388   
2012-01-04   |   0.772803   
2012-01-05   |   0.781781 

I have some independent variables which are like unemployment rate, GDP of countries etc. These are either monthly or quarterly data. 我有一些独立变量,例如失业率,国家/地区的GDP等。这些都是月度或季度数据。 For example, unemployment data for Austria looks like this. 例如,奥地利的失业数据如下所示。

YrQtr   |   UnempRate          
2012-Q1 |   4.553893   
2012-Q2 |   4.915041   
2012-Q3 |   5.204023   
2012-Q4 |   5.042323   
2013-Q1 |   5.470267  

How do I convert this to a daily time series so that the dependent and independent variables have the granularity? 如何将其转换为每日时间序列,以便因变量和自变量具有粒度? In this case, how do I convert this quarterly data into daily? 在这种情况下,如何将季度数据转换为每日数据?

My idea is to ultimately use the ARIMA model. 我的想法是最终使用ARIMA模型。

This issue is resolved. 此问题已解决。 i used cubic interpolation for the conversion. 我使用三次插值进行转换。 Here is my code. 这是我的代码。

## Using Cubic interpolation, converting quarterly data to monthly
# Quarter in year-quarter format
currAcctBal$quarter = as.yearqtr(currAcctBal$YrQtr,format="%Y-Q%q")

# Quarter in year-month-day format
currAcctBal$qvar = as.Date(currAcctBal$quarter)

# Creating a monthly sequence for the quarterly range
monthly = seq(currAcctBal$qvar[1], tail(currAcctBal$qvar, 1), by="month")

# Adding 2 more months to the list
monthly = c(monthly, as.Date("2015-11-01"))
monthly = c(monthly, as.Date("2015-12-01"))

##### Cubic interpolation using spline()
### Getting variable of interest for Austria
subAus = subset(currAcctBal, select = c("qvar", "currAcctBalRate.AUT"))
currAcctBalAus = data.frame(qvar=monthly, AcctBal=spline(subAus, 
method="fmm", xout=monthly)$y)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM