## defining experts' predictions ##
you <- matrix(c(your_mean,your_sd,your_skewness),ncol=3)
#enter your prediction by replacing the appropriate words for the appropriate numbers
expert1 <- matrix(c(14500,1100,.8),ncol=3)
expert2 <- matrix(c(15500,3000,1.8),ncol=3)
expert3 <- matrix(c(19000,3500,1.1),ncol=3)
#predictions by three fictive experts experts
experts <- rbind(expert1,expert2,expert3,you)
#sore all experts' predictions in one matrix with 1 row per expert
#The means in column 1, the sd's in column 2 and the skewness in column 3
## simulating new data ##
set.seed(11235)
Y2018 <- rep(NA,20)
Y2018[c(1,2,6,7,9:20)] <- rnorm(16,17000,5000)
#get data for the year 2018
## package DAC ##
install.packages("DAC")
#install package
library(DAC)
#load package
## Calculating the DAC values ##
set.seed(81325)
out <- DAC_Uniform(data = na.omit(Y2018),bench.min = 0,bench.max = 30000,experts = experts,lb.area = 0,ub.area = 30000,step=.1)
#calculate DAC values for you and the three fictive experts.
#ender as data the simulated values from the vector Y2018
#the benchmark prior is set as a uniform prior between 0 and 30.000 by the input bench.min and bench.max
#the area of the parameter space we choose to look at is set between 0 and 30.000 by the lb.area and ub.area
#the precision by which we look is set at .1 by the step function. The smaller this is set the more accurate the DAC
#scores become, yet the longer the calculation takes.
## ploting the experts' predictions and actual results ##
x <- seq(from=0,to=30000,by=.1)
#get the range for the x-axis of the plot
#from is equal to lb.area in DAC_Uniform
#to is equal to ub.area in DAC_Uniform
#by is equal to step in DAC_Uniform
densities <- cbind(dnorm(x,out$posterior.distribution[1],out$posterior.distribution[2]),
dsnorm(x,experts[1,1],experts[1,2],experts[1,3]),
dsnorm(x,experts[2,1],experts[2,2],experts[2,3]),
dsnorm(x,experts[3,1],experts[3,2],experts[3,3]),
dsnorm(x,experts[4,1],experts[4,2],experts[4,3]))
#get a matrix with the density value specified at each x-axis location per row
#column 1 is for the posterior, column 2 for expert 1, colomn 3 for expert 2
#column 4 for expert 3 and column 5 for your prediction.
matplot(x,densities,type="l",yaxt="n",ylab="Density",xlab="",lwd=3)
legend("topright",c("Posterior","Expert 1", "Expert 2","Expert 3", "You"),lty=1:5,col=1:5,lwd=2)