为什么 ggfortify 在这 2 个时间序列图上失败了?
Why is ggfortify failing with this 2 time series plot?
我在使用 GGfortify 包处理 2 个时间序列的单个图时遇到问题。
我运行最后一行出问题了。是否可以进行更正?
library(Ecdat)
inflation <- as.numeric(Mishkin[, 1])
data_ts <- ts(inflation,start=c(1950,2), frequency = 12)
AR_data <- arima(data_ts, order = c(1,0,0))
AR_data_fitted <- data_ts - residuals(AR_data)
combined <- cbind(data_ts,AR_data_fitted)
gg <- autoplot(combined, columns = c(1,2),cmain = "Inflation Data")
使用下面的代码
library(ggfortify)
combined <- cbind(data_ts,AR_data_fitted)
colnames(combined) <- c("Original Data", "AR fitted data")
autoplot(combined,main = "Inflation Data",facets = FALSE)
更新
autoplot(combined,main = "Inflation Data",facets = FALSE)+
scale_color_manual(values=c("blue", "black"))
我在使用 GGfortify 包处理 2 个时间序列的单个图时遇到问题。
我运行最后一行出问题了。是否可以进行更正?
library(Ecdat)
inflation <- as.numeric(Mishkin[, 1])
data_ts <- ts(inflation,start=c(1950,2), frequency = 12)
AR_data <- arima(data_ts, order = c(1,0,0))
AR_data_fitted <- data_ts - residuals(AR_data)
combined <- cbind(data_ts,AR_data_fitted)
gg <- autoplot(combined, columns = c(1,2),cmain = "Inflation Data")
使用下面的代码
library(ggfortify)
combined <- cbind(data_ts,AR_data_fitted)
colnames(combined) <- c("Original Data", "AR fitted data")
autoplot(combined,main = "Inflation Data",facets = FALSE)
更新
autoplot(combined,main = "Inflation Data",facets = FALSE)+
scale_color_manual(values=c("blue", "black"))