Step 11: Getting from VolleyMetrics to Expected Value Added (eV+). Step by Step.

1. Download the .dvw files from VolleyMetrics.

2. Download and install R.

2.1 for Mac, you’re looking for something like this on that next page – go ahead and click on the .pkg file and download that:

on a Mac, you’re looking for something that looks like this.

2.2 for Windows, you’re looking for this (base), then this (actual download).

3. Download and install RStudio, an IDE (integrated development environment) for R. This will make everything easier to work with and you really don’t want to use R without it.

4. Open RStudio and select New Directory – then New Project under Project Type. Name the directory whatever you’d like and you can set the project as a subdirectory of some other folder. Or just leave it blank. Either is fine.

5. You should be here now:

6. Get .dvw files into the correct folder so we can easily read/import them into R. You’re going to type “getwd()” and hit enter (those are parentheses, not a zero). This will give you the “working directory” location – it’s just a fancy name for where you want to save stuff and/or easily pull files from. You can see that mine on my mac is just my Users folder

7. All this really means is that in my chad.gordon folder, there’s a new folder that R built called volleydork. Inside that new volleydork folder is where R has saved the new project I just created.

8. Your “working directory” is important. Throw all of your .dvw files in there. My advice? Just throw them in by themselves. Don’t have them in folders, just dump a bunch of .dvw files directly into that volleydork folder. Like below:

9. Ok great, we have RStudio up and running, we have all the raw data in our “working directory” (the same folder as the project itself, the .Rproj file). Now we need to download a couple tools to help us get where we need to go.

10. First we’re going to need a couple libraries in R. Libraries are packaged chunks of functions that we can take advantage of. So in our case, rather than figuring out how to chop up a .dvw file into something useful, there’s a package for that! (Thanks Ben Raymond!).

10.1 First line of code you’ll need:

install.packages(“remotes”) (you’ll need to type this in manually as quotes on this blog are different from quotation marks in R)

remotes::install_github(“openvolley/datavolley”) (same here, same quote-based issue)

10.2 Ben reminded me that his package isn’t on CRAN so you’ll need to install it this way ^^

10.3 To add the other libraries to R, we type: install.packages(“tidyverse”) and hit enter. Rinse and repeat with the classInt, cluster, factoextra, gridExtra packages. I honestly can’t remember what half of those do, but apparently I needed them.

11. Now, you’ll need all the code.

12. Go here, copy the code, and run it:

12.1 Then go here, copy the code, and run it (this code is a little older, but will get the ball rolling):

13. Ta-da!

14. No but really, the first piece is what I use to “parse” the .dvw file. To get it into something usable for analysis. The second piece is what I use to create the Expected Value columns and whatnot.

15. Test it out

15.1 Try running the following:

a <- aggregate(eV_added ~ team*player_name, subset(master, skill==”Attack”), mean)
b <- aggregate(count ~ team*player_name, subset(master, skill==”Attack”), sum)
c <- merge(a,b)

15.2 This will give you the Expected Value Added (eV+) for Attacking by player, by team plus the count of the number of attempts.

15.3 From here, you can play around with other stuff, but you’ll also have a neat dataframe of all your matches, you can reference stuff by match_id, set_id, etc…look at specific teams, players, etc.

15.4 Keep in mind, that during the parsing process, I doooo chop out a few columns that I don’t find super useful. This is because I’m working with like millions of rows of data so chopping out a bunch of columns saves me a lot of time. For you, you might want to go back into the Parse code and remove the line: master <- master[,c(1,2,4,6,8,10,11,12,13,14,19,20,21,23,24,54,55,56,57,58,59,72,73,74,75,79,80,81,82,83)]

This is me only keeping certain columns. Just an FYI.

15.5 Also, please keep in mind that we are creating “Expected Value” using the situational efficiencies described in previous posts. You are obviously free to change these to suit your needs. But this is the just baseline that I am currently running with as an example.

15.6 Good luck!

15.7 Back now, to predicting the future.

Step 12.