R中未观察到的组件模型(UCM)错误消息(RUCM包)

时间:2016-01-28 05:23:15

标签: r time-series

我有过去2年的每日数据。我有月度季节性。所以我想包含11个虚拟变量。

google.maps.event.addListener(map, 'click', function (event) {


        document.getElementById("lat").value = event.latLng.lat();
        document.getElementById("long").value = event.latLng.lng();
        marker.setPosition(lat, lng);
        marker.setMap(map);

    });

当我尝试运行命令时

dat<-read.csv("data.csv")
val.ts <- ts(dat$Actual,start=c(2014,1,1),freq=12)

我收到错误消息

mymod <- ucm(val.ts~dat[,2:12],cycle = TRUE,cycle.period = 12)

1 个答案:

答案 0 :(得分:2)

查看以下内容是否适合您。

library(rucm)

dat <- read.csv("data.csv")
fo <- as.formula(paste("Actual ~ ", paste(names(dat)[2:13], collapse= "+")))
mymod <- ucm(fo, data = dat, cycle = TRUE, cycle.period = 12)

这是一个虚拟数据的测试:

set.seed(123)
dat <- as.data.frame(cbind(Nile, matrix(rnorm(1200), 100, 12)))
colnames(dat) <- c("Actual", paste0("V", 1:12))
fo <- as.formula(paste("Actual ~ ", paste(names(dat)[2:13], collapse= "+")))
mymod <- ucm(fo, data = dat, cycle = TRUE, cycle.period = 12)

mymod
# Call:
# ucm(formula = fo, data = dat, cycle = TRUE, cycle.period = 12)

# Parameter estimates:
#     Estimate Approx.StdErr   t.val p.value  
# V1   -8.1606       15.4735 -0.5274 0.59925  
# V2    4.6288       14.1291  0.3276 0.74399  
# V3    7.7008       14.7144  0.5234 0.60205  
# V4  -15.8045       14.0253 -1.1269 0.26287  
# V5  -11.5938       14.4435 -0.8027 0.42431  
# V6  -22.4537       14.9448 -1.5024 0.13656  
# V7   -2.6873       13.2951 -0.2021 0.84028  
# V8  -26.5699       14.1251 -1.8810 0.06327 .
# V9   12.5518       12.9471  0.9695 0.33497  
# V10  13.3437       13.8729  0.9619 0.33876  
# V11 -12.0410       13.2171 -0.9110 0.36477  
# V12   2.8637       13.8277  0.2071 0.83641  
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

# Estimated variance:
# Irregular_Variance     Level_Variance     Cycle_Variance 
#         14722.8809           545.6452             7.0148