## Data preparation: generate a sample dataset with inflation and survey data
inflation<-c(1.5, 1.5, 1.5, 1.1, 0.9, 1.3, 1.3, 1.2, 1.7, 1.7, 1.5, 2, 1.4, 1.9, 1.9, 2.3, 2.8,
2.5, 2.1, 2.1, 1.9, 1.9, 1.5, 1.6, 2.1, 1.8, 2.1, 1.5, 1.3, 1.1, 1.1, 1.3, 1.3, 1.3, 1.1,
1.1, 1, 1.2, 1.1, 0.9)
answer.up<-c(72.7, 69.7, 60.9, 53.7, 54.9, 54.8, 56.1, 51.7, 62.2, 54.2, 39.8, 18.6, 5.4, 8.2,
8.6, 8.5, 16, 18.9, 7.7, 6.5, 6.4, 7, 7.4, 6.8, 9.5, 17.1, 13.1, 21.5, 22.7, 26.9, 32.4,
20.2, 20.4, 15.8, 11.4, 7.9, 11.3, 10, 11.3, 9.7)
answer.same<-c(24.1, 22.8, 24.3, 26.2, 31.1, 35.4, 33, 35.5, 27.4, 24.8, 32.1, 44.8, 41.8,
37.9, 33.2, 30.9, 29.9, 22.1, 17.2, 15.5, 21.8, 25.2, 23.2, 24.2, 32.9, 31.2, 42.2, 50.5,
52.5, 56.3, 53.8, 62.8, 65.6, 63, 60.3, 61.1, 57.8, 63, 61.4, 61.9)
answer.down<-c(3.2, 7.5, 14.8, 20.1, 14, 9.8, 10.9, 12.8, 10.4, 21, 28.1, 36.6, 52.8, 53.9,
58.2, 60.6, 54.1, 59, 75.1, 78, 71.8, 67.8, 69.4, 69, 57.6, 51.7, 44.7, 28, 24.8, 16.8,
13.8, 17, 14, 21.2, 28.3, 31, 30.9, 27, 27.3, 28.4)
## Call ce for quantification
quant.ce<-ce(inflation, answer.up, answer.same, answer.down, first.period=30, last.period=36,
forecast.horizon=4, exp.horizon.type = "fix", fix.horizon.start = 1, fix.horizon.end = 29)
Run the code above in your browser using DataLab