-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathall.R
More file actions
70 lines (56 loc) · 1.47 KB
/
all.R
File metadata and controls
70 lines (56 loc) · 1.47 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
library(dplyr)
downgrade <- 10 ## 0 for no downgrade (power = number completed)
avenueMissing <- -95
avenueMSAF <- -99
testwt <- c(25, 25, 40)
asntot <- c(16, 12, 9, 10)
polls <- read.csv(input_files[[1]])
tab <- (TA
%>% left_join(finalScore)
%>% left_join(polls)
%>% mutate(
final = ifelse(is.na(final), 0, final)
, poll = ifelse(is.na(poll), 0, poll)
)
)
print(summary(tab))
# The 3SS power average is an L-mean where L is a function of the number of tests completed
powerAve <- function(scores, dens, weights){
scores <- ifelse(scores==avenueMissing, 0, scores)
scores <- ifelse(scores==avenueMSAF, NA, scores)
power <- sum(sign(1+scores), na.rm=TRUE)
power <- (power+downgrade)/(1+downgrade)
weight <- sum(sign(1+scores)*weights, na.rm=TRUE)
scores <- scores/dens
tot <- sum(scores^power*weights, na.rm=TRUE)
return((tot/weight)^(1/power))
}
tab <- (tab
%>% rowwise()
%>% mutate(testAve = powerAve(
scores=c(T1, T2, final)
, dens=testwt, weights=testwt
))
)
# Legacy code for dropping assignments (when one is optional).
dropAve <- function(scores, dens){
perc <- scores/dens
drop <- which.min(perc)[[1]]
scores[[drop]] <- NA
return(powerAve(scores, dens, weights=1))
}
# We use powerAve (L=1), because it deals properly with NAs.
tab <- (tab
%>% mutate(asnAve = powerAve(
scores=c(A1, A2, A3, A4)
, dens=asntot
, weights=1
))
)
tab <- (tab
%>% mutate(
mark = floor(90.*testAve + 10.*asnAve + poll)
)
)
print(mean(tab$mark>=89.5))
summary(tab)