Casey’s Fantasy Grades

Hey guys, so since I’m a nerd and do biology statistical analytics for a living, I wrote a quick bit of code to give us a visual view of how our draft went. I agreed with Casey so I thought it would be fun to mark this down and be able to look back at it and see how much a draft really affects our season. Hopefully at the end of the season, I can do another write up to see how much the draft affects outcome in this league.

Grades

Ignore the code but I converted Casey’s grades to a table for each player in the league.

library(knitr)
setwd("~/Desktop/fant/")
grades <- read.table("fant.csv", header = TRUE, sep = ",", stringsAsFactors = FALSE)
kable(grades, align = "c")
Players QB RB.Core WR.core TE Starters Bench
Ryan A B A A A- B+
Ari B B+ B+ B- B C
Tommy B B- B- C+ B- B-
Sam A- C+ A- B+ B C
Casey B- B A A+ B B+
Turtle A B B B+ A- C
Alex B A A- B B+ B+
Urbach B+ A+ C A- A- C
Connor A B A- B+ A- B+
Sean B+ B B A- B B

Grades

The next thing I did was convert each draft grade to a GPA total, the same system U of O had (A+ = 4.3, A = 4.0, etc).

Players QB RB.Core WR.core TE Starters Bench
Ryan 4.0 3.0 4.0 4.0 3.7 3.3
Ari 3.0 3.3 3.3 2.7 3.0 2.0
Tommy 3.0 2.7 2.7 2.3 2.7 2.7
Sam 3.7 2.3 3.7 3.3 3.0 2.0
Casey 2.7 3.0 4.0 4.3 3.0 3.3
Turtle 4.0 3.0 3.0 3.3 3.7 2.0
Alex 3.0 4.0 3.7 3.0 3.3 3.3
Urbach 3.3 4.3 2.0 3.7 3.7 2.0
Connor 4.0 3.0 3.7 3.3 3.7 3.3
Sean 3.3 3.0 3.0 3.7 3.0 3.0

Make a bar plot of outcomes

A function that will plot all of the categories.

Overall team power index

Lastly, this is the one that I will think will be most interesting. This is the average of all of the categories combinded, so (QB + RB + WR + TE + STARTERS + BENCH) / 6. I call it just the overall team power index. At the end of the season I’ll do a regression of each of our team’s placement vs the overall team power index to see how draft (or casey’s interpretation) affects overall outcome. Also, I’ll say it’s pretty cool all of our teams fall in the A-B range, we are all looking good.. May the best team win!

averageplot <- function(table) {
  rownames(table) <- table$Players
  table <- table[,-1]
  avg <- rowMeans(table)
  assign("Average", data.frame(OPI=avg), envir = .GlobalEnv)
  print(kable(data.frame(Team=names(avg), score=avg, row.names = 1:10)))
  avg <- data.frame(Player = names(avg), Average = as.numeric(avg))
  plotbar(avg$Average, color = "#CC79A7", title = "Overall Team Power Index")
}
averageplot(gpa)
## 
## 
## Team         score
## -------  ---------
## Ryan      3.666667
## Ari       2.883333
## Tommy     2.683333
## Sam       3.000000
## Casey     3.383333
## Turtle    3.166667
## Alex      3.383333
## Urbach    3.166667
## Connor    3.500000
## Sean      3.166667

Week 2 Update

Week 2 takeaways. Casey seems to have gotten the steal of the draft in Kareem Hunt. Secondly, Urby is screwed. Actually screwed is an understatement for urby, urby is beyond screwed. Actually if i could use a picture as a metaphor for Urby’s team it’d be: Good luck this week boys! Except for Casey. ! ## Stats

Games <- read.table("week2.csv", sep=",", header=T)
kable(Games, align='c')
TEAMOWNER PF PA HOME AWAY DIV STREAK
Casey 258.5 208.0 1-0-0 1-0-0 2-0-0 W2
Connor 235.5 244.5 0-1-0 1-0-0 1-1-0 W1
Sean 231.0 190.0 0-1-0 1-0-0 1-1-0 L1
Ryan 224.5 202.5 0-1-0 1-0-0 1-1-0 W1
Alex 223.0 239.5 0-1-0 1-0-0 1-1-0 L1
Ari 215.5 231.0 0-0-0 1-1-0 1-1-0 L1
Tommy 212.5 203.0 0-1-0 1-0-0 1-1-0 W1
Turtle 211.0 195.0 0-1-0 1-0-0 1-1-0 W1
Sam 191.0 228.0 0-1-0 1-0-0 1-1-0 L1
Urbach 169.0 230.0 0-2-0 0-0-0 0-2-0 L2
Average$Players <- row.names(Average)
Complete <- merge(Average, Games, by.x = "Players",by.y = "TEAMOWNER")
rownames(Complete) <- sort(rownames(Average))
rownames(Complete) <- sort(rownames(Average))
PF <- lm(formula = Complete$OPI ~ Complete$PF)
scatter <- function(dataframe, x, y, title) {
  dat <- dataframe
  lin<- coef(lm(dat[[x]]~dat[[y]]))
  ggplot(dat, aes_string(y, x, label = "rownames(Complete)"), environment = .GlobalEnv) +
    geom_point() +
    stat_smooth(method = "lm", se = FALSE, col = "red") +
    geom_text(vjust = 0) +
    ggtitle(title)
}

winPCT <- function(df) {
  record <- read.table(text = as.character(df$DIV), sep="-", colClasses = "character")  
  colnames(record) <- c("Wins", "Losses", "Ties")
  record$PCT <- as.numeric(record$Wins)/(as.numeric(record$Losses) + as.numeric(record$Wins))
  record$PCT[which(record$PCT == Inf)] <- 1.00
  return(record$PCT)
}
Complete$WinPCT <- winPCT(Complete)

plotbar2 <- function(category, color, title ) {
  reorder_teams <- function(x) {
      factor(Complete$Players, levels = Complete$Players[order(x, decreasing = TRUE)])
    
  }
  ggplot(gpa, aes(x = reorder_teams(category), y= category)) + 
    geom_bar(stat = "identity", fill=color) +
    ggtitle(title) +
    ylab(title) +
    xlab("Jabroni")
}

plotbar2(Complete$WinPCT, color = "#009E73", title = "Win Percentage")

plotbar2(Complete$PF, color = "#E69F00", title = "Points For")

plotbar2(Complete$PA, color = "#0072B2", title = "Points Allowed")

Regressions

Intresting to see how the Overall Power Index (draft GPA) has affected the season.

scatter(Complete, x = "PF", y = "OPI", title = "PF vs OPI")

#scatter(Complete, x = "WinPCT", y = "OPI", title = "Win% vs OPI")
scatter(Complete, x = "PF", y = "PA", title = "PF vs PA")

Week 3 Update

Week 3 takeaways. Everyone is still alive and no one is undefeated! Urby still has a tiny fraction of a life left (..not really…), Kareem Hunt is still good, and Stefon Diggs is lookind reallll niceeeeee (Shameful plug) Sean had a one of the worst weeks in years this week. Unfotunatly it’s not looking like a bounce back season for him.. Actually I believe this photo was taken of Sean this past sunday… Sorry Seannnnnn…

Stats

winPCT <- function(df) {
  record <- read.table(text = as.character(df$DIV), sep="-", colClasses = "character")  
  colnames(record) <- c("Wins", "Losses", "Ties")
  record$PCT <- as.numeric(record$Wins)/(as.numeric(record$Losses) + as.numeric(record$Wins))
  record$PCT[which(record$PCT == Inf)] <- 1.00
  return(record$PCT)
}

add_columns <- function(filepath) {
  Games <- read.table(filepath, sep=",", header=T)
  Complete <- merge(Average, Games, by.x = "Players",by.y = "TEAMOWNER")
  rownames(Complete) <- sort(rownames(Average))
  rownames(Complete) <- sort(rownames(Average))
  Complete$WinPCT <- winPCT(Complete)
  Complete$PlusMinus <- Complete$PF - Complete$PA
  return(Complete)
}
Complete <- add_columns("~/Desktop/fant/week3.csv")
kable(Complete, align='c')
Players OPI PF PA HOME AWAY DIV STREAK WinPCT PlusMinus
Alex Alex 3.383333 361.5 360.0 1-1-0 1-0-0 2-1-0 W1 0.6666667 1.5
Ari Ari 2.883333 334.0 395.5 0-1-0 1-1-0 1-2-0 L2 0.3333333 -61.5
Casey Casey 3.383333 379.0 346.5 1-0-0 1-1-0 2-1-0 L1 0.6666667 32.5
Connor Connor 3.500000 351.5 381.5 0-2-0 1-0-0 1-2-0 L1 0.3333333 -30.0
Ryan Ryan 3.666667 318.0 252.5 1-1-0 1-0-0 2-1-0 W2 0.6666667 65.5
Sam Sam 3.000000 355.5 346.5 0-1-0 2-0-0 2-1-0 W1 0.6666667 9.0
Sean Sean 3.166667 281.0 283.5 0-1-0 1-1-0 1-2-0 L2 0.3333333 -2.5
Tommy Tommy 2.683333 349.5 319.0 0-1-0 2-0-0 2-1-0 W2 0.6666667 30.5
Turtle Turtle 3.166667 303.5 289.0 0-2-0 1-0-0 1-2-0 L1 0.3333333 14.5
Urbach Urbach 3.166667 263.0 322.5 0-2-0 1-0-0 1-2-0 W1 0.3333333 -59.5
plotbar2(Complete$WinPCT, color = "#009E73", title = "Win Percentage")

plotbar2(Complete$PF, color = "#E69F00", title = "Points For")

plotbar2(Complete$PA, color = "#0072B2", title = "Points Allowed")

plotbar2(Complete$PlusMinus, color = "#CC79A7", title = "Overall Plus Minus on Season")

Complete$AverageWin <- Complete$PlusMinus / 3
plotbar2(Complete$AverageWin, color = "#009E73", title = "Average Margin of Vitory")

Regressions

Too early to really see how draft affects correlation but not looking like draft has a big impact.

scatter(Complete, x = "PF", y = "OPI", title = "PF vs OPI")

scatter(Complete, x = "WinPCT", y = "OPI", title = "Win% vs OPI")

scatter(Complete, x = "PF", y = "PA", title = "PF vs PA")

Week 5 Update

Week 5 takeaways. We seem to be seperating out finally.

Tyler and Turtle are gonna need a huge miracle to make it to the playoffs unfortunately, as they sit at 1-4.

On the oppisite end, Ryan and Sam gotta feel real good right now about their playoff chances as they are currently in the lead at 4-1. Sam’s team is undeniably doing the best this year while stats are showing that Singer’s team is fairing well in the luck column. He ranks 5th in points to his credit, but he’s dead last (by far) in points allowed. Don’t choke Singer!

My team had a pretty good week but after losing OBJ and Dalvin Cook, my future is not seeming bright so well see what happens.

Connor’s team is decent but he is in bye week hell this week so this week might end up in an L.

Tommy Ari and Casey are coming into a big week as they sit 2-3 and this week might be do or die. 3-3 sounds a hell of a lot better than 2-4 so win this week!

On a seperate note, It’s important to note that Casey seems to be in a freefall. He’s averaging just 103 points in the last two games and has lost three straight. On top of that he just spent HALF ($75!!) on latavious murray this week, putting his remaining budget at just $49. He’s got to be worried.

Stats

Complete <- add_columns("~/Desktop/fant/week_5.csv")
kable(Complete, align='c')
Players OPI PF PA HOME AWAY DIV STREAK WinPCT PlusMinus
Alex Alex 3.383333 585.0 573.5 2-1-0 1-1-0 3-2-0 W1 0.6 11.5
Ari Ari 2.883333 553.5 621.5 0-2-0 2-1-0 2-3-0 L1 0.4 -68.0
Casey Casey 3.383333 583.5 595.5 1-1-0 1-2-0 2-3-0 L3 0.4 -12.0
Connor Connor 3.500000 613.5 596.5 1-2-0 2-0-0 3-2-0 W2 0.6 17.0
Ryan Ryan 3.666667 555.5 408.0 2-1-0 2-0-0 4-1-0 W4 0.8 147.5
Sam Sam 3.000000 634.5 563.0 1-1-0 3-0-0 4-1-0 W3 0.8 71.5
Sean Sean 3.166667 496.0 477.5 2-1-0 1-1-0 3-2-0 W2 0.6 18.5
Tommy Tommy 2.683333 545.5 570.0 0-2-0 2-1-0 2-3-0 L2 0.4 -24.5
Turtle Turtle 3.166667 490.5 529.0 0-2-0 1-2-0 1-4-0 L3 0.2 -38.5
Urbach Urbach 3.166667 463.0 586.0 0-3-0 1-1-0 1-4-0 L2 0.2 -123.0
plotbar2(Complete$WinPCT, color = "#009E73", title = "Win Percentage")

plotbar2(Complete$PF, color = "#E69F00", title = "Points For")

plotbar2(Complete$PA, color = "#0072B2", title = "Points Allowed")

plotbar2(Complete$PlusMinus, color = "#CC79A7", title = "Overall Plus Minus on Season")

Complete$AverageWin <- Complete$PlusMinus / 5
plotbar2(Complete$AverageWin, color = "#009E73", title = "Average Margin of Vitory")

Regressions

Too early to really see how draft affects correlation but not looking like draft has a big impact.

scatter(Complete, x = "PF", y = "OPI", title = "PF vs OPI")

scatter(Complete, x = "WinPCT", y = "OPI", title = "Win% vs OPI")

scatter(Complete, x = "PF", y = "PA", title = "PF vs PA")

Week 7

Stats

Quick Takeaways:

  • Singer is a lucky dude. By far least points for
  • Lots of teams at 4-3
Complete <- add_columns("~/Desktop/fant/week7.csv")
kable(Complete, align='c')
Players OPI PF PA HOME AWAY DIV STREAK WinPCT PlusMinus
Alex Alex 3.383333 842.5 801.5 2-2-0 2-1-0 4-3-0 L1 0.5714286 41.0
Ari Ari 2.883333 803.0 856.5 0-2-0 3-2-0 3-4-0 W1 0.4285714 -53.5
Casey Casey 3.383333 782.0 773.0 2-1-0 1-3-0 3-4-0 L1 0.4285714 9.0
Connor Connor 3.500000 841.5 839.5 1-3-0 3-0-0 4-3-0 W1 0.5714286 2.0
Ryan Ryan 3.666667 786.5 622.5 3-1-0 3-0-0 6-1-0 W6 0.8571429 164.0
Sam Sam 3.000000 855.5 769.0 1-2-0 4-0-0 5-2-0 L1 0.7142857 86.5
Sean Sean 3.166667 729.5 749.0 3-1-0 1-2-0 4-3-0 W1 0.5714286 -19.5
Tommy Tommy 2.683333 783.5 697.0 2-2-0 2-1-0 4-3-0 W2 0.5714286 86.5
Turtle Turtle 3.166667 713.5 845.0 0-3-0 1-3-0 1-6-0 L5 0.1428571 -131.5
Urbach Urbach 3.166667 666.0 850.5 0-4-0 1-2-0 1-6-0 L4 0.1428571 -184.5
plotbar2(Complete$WinPCT, color = "#009E73", title = "Win Percentage")

plotbar2(Complete$PF, color = "#E69F00", title = "Points For")

plotbar2(Complete$PA, color = "#0072B2", title = "Points Allowed")

plotbar2(Complete$PlusMinus, color = "#CC79A7", title = "Overall Plus Minus on Season")

Complete$AverageWin <- Complete$PlusMinus / 7
plotbar2(Complete$AverageWin, color = "#009E73", title = "Average Margin of Vitory")

Regressions

The first graph is interesting, youre vertical distance from regression (line) is how much better or worse (above or below) you are doing compared to where you should be by points for and/or how lucky you are.

scatter(Complete, y = "PF", x = "WinPCT", title = "PF vs WinPCT")

scatter(Complete, x = "PF", y = "OPI", title = "PF vs OPI")

scatter(Complete, x = "WinPCT", y = "OPI", title = "Win% vs OPI")

scatter(Complete, x = "PF", y = "PA", title = "PF vs PA")

Week 8

Stats

Quick Takeaways:

Big matchups this week! League is tight!

Complete <- add_columns("~/Desktop/fant/week8.csv")
kable(Complete, align='c')
Players OPI PF PA HOME AWAY DIV STREAK WinPCT PlusMinus
Alex Alex 3.383333 1001.5 909.0 3-2-0 2-1-0 5-3-0 W1 0.625 92.5
Ari Ari 2.883333 890.5 985.5 0-3-0 3-2-0 3-5-0 L1 0.375 -95.0
Casey Casey 3.383333 899.0 875.0 3-1-0 1-3-0 4-4-0 W1 0.500 24.0
Connor Connor 3.500000 943.5 956.5 1-3-0 3-1-0 4-4-0 L1 0.500 -13.0
Ryan Ryan 3.666667 906.5 758.0 3-2-0 3-0-0 6-2-0 L1 0.750 148.5
Sam Sam 3.000000 963.0 928.0 1-2-0 4-1-0 5-3-0 L2 0.625 35.0
Sean Sean 3.166667 858.5 836.5 3-1-0 2-2-0 5-3-0 W2 0.625 22.0
Tommy Tommy 2.683333 885.0 782.0 2-2-0 3-1-0 5-3-0 W3 0.625 103.0
Turtle Turtle 3.166667 798.5 946.5 0-4-0 1-3-0 1-7-0 L6 0.125 -148.0
Urbach Urbach 3.166667 801.5 970.5 0-4-0 2-2-0 2-6-0 W1 0.250 -169.0
plotbar2(Complete$WinPCT, color = "#009E73", title = "Win Percentage")

plotbar2(Complete$PF, color = "#E69F00", title = "Points For")

plotbar2(Complete$PA, color = "#0072B2", title = "Points Allowed")

plotbar2(Complete$PlusMinus, color = "#CC79A7", title = "Overall Plus Minus on Season")

Complete$AverageWin <- Complete$PlusMinus / 7
plotbar2(Complete$AverageWin, color = "#009E73", title = "Average Margin of Vitory")

Regressions

scatter(Complete, y = "PF", x = "WinPCT", title = "PF vs WinPCT")

scatter(Complete, x = "PF", y = "PA", title = "PF vs PA")

scatter(Complete, x = "PF", y = "OPI", title = "PF vs OPI")

scatter(Complete, x = "WinPCT", y = "OPI", title = "Win% vs OPI")