-
Notifications
You must be signed in to change notification settings - Fork 1
/
Incentive Accuracy Mechanics Basic 150221.R
52 lines (34 loc) · 1.24 KB
/
Incentive Accuracy Mechanics Basic 150221.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
if (qnClass[t]=="ordered multinomial") {
actt <-rep(0,length(tmp1)-1)
tmp2 <- as.double(strsplit(as.vector(nvtData[t]),",")[[1]])
#print(tmp2)
actt <-rep(0,length(tmp1)-1)
for (o in 1:(length(tmp1)-1)) {
actt[o] <- 2*(sum(tmp2[1:o])-sum(tmp1[1:o]))^2
}
brier[t] <- sum(actt)/(length(tmp1)-1)
#print (c("ordered",tmp1,"-", act[t]))
}
if (qnClass[t]=="unordered multinomial") {
tmp2 <- as.double(strsplit(as.vector(nvtData[t]),",")[[1]])
brier[t] <- sum( (tmp2-tmp1)^2 )
#print (c("unordered",tmp1,"-", act[t]))
}
if (qnClass[t]=="binary") {
tmp2 <- as.double(strsplit(as.vector(nvtData[t]),",")[[1]])
brier[t] <- sum( (tmp2-tmp1)^2 )
#print (c("binary",tmp1,"-", act[t]))
}
if (qnClass[t]=="scaled") {
#act[1] <- acun[t] <- (length(tmp1)-1)*(1/length(tmp1))^2+(1-1/length(tmp1))^2
tmp2 <- as.double(strsplit(as.vector(nvtData[t]),",")[[1]])
brier[t] <- sum( (tmp2-tmp1)^2 )
#print (c("scale",tmp1,"-", act[t]))
}
if (qnClass[t]=="shares") {
#act[1] <- acun[t] <- (length(tmp1)-1)*(1/length(tmp1))^2+(1-1/length(tmp1))^2
tmp2 <- as.double(strsplit(as.vector(nvtData[t]),",")[[1]])
brier[t]<- sum( (tmp2-tmp1)^2 )
#print (c("scale",tmp1,"-", act[t]))
}
#print (c(tmp1, acqu[t]))