-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.qmd
More file actions
149 lines (110 loc) · 10.3 KB
/
index.qmd
File metadata and controls
149 lines (110 loc) · 10.3 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
{{< include _chunk-timing.qmd >}}
# Preface {#sec-preface .unnumbered .unlisted}
```{r}
#| include: false
# Objects loaded but not generated during GitHub Action run: betaRegression.RData, bayesianMixedModelFit.RData, modelPredictions_bayesian.RData, monteCarloSim_results.RData
# Packages to drop:
# Automatically create a bib database for R packages
packagesForBibliography <- c(
"petersenlab", "ffanalytics",
"knitr", "rmarkdown", "broom", "broom.mixed", "psych", "downlit", "xml2",
"gsisdecoder", "progressr", "DescTools", "pwr", "pwrss", "WebPower", "XICOR",
"dagitty", "ggdag", "ggtext", "gghighlight", "ggExtra", "patchwork",
"pROC", "lme4", "lmerTest", "MuMIn", "emmeans", "pbkrtest", "sjstats",
"AICcmodavg", "rstan", "brms", "tidybayes", "bbmle", "fitdistrplus", "sn",
"mclust", "magrittr", "viridis", "viridisLite", "msir", "plotly", "webshot2",
"quantmod", "fPortfolio", "NMOF", "nFactors", "xts", "zoo", "forecast",
"parallelly", "doParallel", "missRanger", "ggridges", "powerjoin",
"bestNormalize", "LongituRF", "gpboost", "cmdstanr", "mgcv", "rms", "car",
"lavaan", "lavaanPlot", "mice", "miceadds", "interactions", "robustbase",
"ordinal", "MASS", "data.table", "future", "future.apply", "SimDesign",
"domir", "GGally","Rglpk","TTR","rockchalk","yhat","tidyLPA",
"base","graphics","grDevices","grid","utils", # packages that are included with base R; get the full list with: rownames(installed.packages(priority="base"))
"tidyverse", "ggplot2", "dplyr", "lubridate", # packages that are part of the tidyverse ecosystem
"nflverse", "nflfastR", "nflseedR", "nfl4th", "nflreadr", "nflplotR", # packages that are part of the nflverse ecosystem
"tidymodels", "rsample", "parsnip", "recipes", "tune", "yardstick", # packages that are part of the tidymodels ecosysyem
"easystats", "see", "performance", "parameters", "correlation", "effectsize", # packages that are part of the easystats ecosystem
"learnr", "remotes", "shiny", "PearsonDS", "lavaangui", "dynamic", "r4ds.tutorials" # packages that are cited but not used for computation (and thus do not need to be installed by me or readers)
)
xfun::pkg_bib(
c(.packages(), packagesForBibliography),
"packages_new.bib")
```
This is a book in progress—it is incomplete.
I will continue to add to and update it as I am able.
## How to Contribute {#sec-contribute}
This is an open-access textbook.
My goal is to share data analysis strategies for free!
Anyone is welcome to contribute to the project.
If you would like to contribute, please consider one of the following:
- [open an issue](https://github.com/isaactpetersen/Fantasy-Football-Analytics-Textbook/issues) or [create a pull request](https://github.com/isaactpetersen/Fantasy-Football-Analytics-Textbook/pulls) on the [book's GitHub repository](https://github.com/isaactpetersen/Fantasy-Football-Analytics-Textbook).\index{GitHub}
- [buy me a coffee](https://www.buymeacoffee.com/isaactpetersen)—Support me in developing this (free!) resource for fantasy football analytics... Even a cup of coffee helps me stay awake!
```{=html}
<script type="text/javascript" src="https://cdnjs.buymeacoffee.com/1.0.0/button.prod.min.js" data-name="bmc-button" data-slug="isaactpetersen" data-color="#FFDD00" data-emoji="" data-font="Lato" data-text="Buy me a coffee" data-outline-color="#000000" data-font-color="#000000" data-coffee-color="#ffffff" ></script>
<a href="https://www.paypal.com/donate/?business=Q4FMMAMFQYTX8&no_recurring=0&item_name=Support+me+in+developing+this+resource+for+fantasy+football+analytics...+Even+a+cup+of+coffee+%28%244.99%29+helps+me+stay+awake%21¤cy_code=USD">(or use PayPal)</a>
<p>
You can also sponsor my open source work using <a href="https://github.com/sponsors/isaactpetersen">GitHub Sponsors</a>.
<br>
<br>
```
The GitHub repository for the book is located here:\index{GitHub} <https://github.com/isaactpetersen/Fantasy-Football-Analytics-Textbook>.
If you have data or analysis examples that you are willing to share and include in the book, feel free to contact me.
## Open Access {#sec-openAccess}
This is an open-access book.
This means that it is freely available for anyone to access.
## License {#sec-license}
{width=25% fig-align="left"}\
The online version of this book is licensed under the [Creative Commons Attribution License](https://creativecommons.org/licenses/by/4.0/).
In short, you can use my work as long as you cite it.
## Citation {#sec-citation}
The APA-style citation for the book is:
Petersen, I. T. (2026). *Fantasy football analytics: Statistics, prediction, and empiricism using R*. Version 0.0.1. University of Iowa Libraries. <https://isaactpetersen.github.io/Fantasy-Football-Analytics-Textbook>. [INSERT DOI LINK]
<!--
[](https://doi.org/10.5281/zenodo.6466589)\
-->
The BibTeX citation for the book is:
```{bibtex}
@book{petersenFantasyFootballAnalytics,
title = {Fantasy football analytics: Statistics, prediction, and empiricism using {R}},
author = {Petersen, Isaac T.},
year = {2026},
publisher = {{University of Iowa Libraries}},
note = {Version 0.0.1},
doi = {INSERT},
isbn = {INSERT},
url = {https://isaactpetersen.github.io/Fantasy-Football-Analytics-Textbook}
}
```
## About the Author {#sec-author}
I am an Associate Professor in the Department of Psychological and Brain Sciences at the University of Iowa.
I am a licensed psychologist with expertise in child clinical psychology.
Why am I writing about fantasy football and data analysis?
Because fantasy football involves the intersection of two things I love: sports and statistics.
Through my training, I have learned the value of statistics for answering important questions that I find interesting.
In graduate training, I came to the realization that statistics is relevant not only for psychology and science, but also for domains that I enjoy as hobbies, including sports and fantasy sports.
I have played in a longstanding fantasy football league for over 20 years (since my junior year of high school) with old friends from high school.
I wanted to apply what I was learning about statistics to help others improve their performance in fantasy football and to help people—including those who might not otherwise be interested—to learn statistics.
So I began blogging online about the value of applying statistics to improve decision making in fantasy football.
Apparently, many people were interested in learning statistics when they could apply them to a domain that they find interesting, like fantasy football.
My blog eventually became [FantasyFootballAnalytics.net](http://fantasyfootballanalytics.net), a website that uses advanced statistics to help people win their fantasy football leagues.
In terms of my `R` and statistics background, I have published many [peer-reviewed publications](https://developmental-psychopathology.lab.uiowa.edu/publications) that employ advanced statistical methods, have published a [book on psychological assessment](https://www.routledge.com/9781032413068) [@Petersen2024a; @PetersenPrinciplesPsychAssessment] that includes applied examples in `R`, and have published the [`petersenlab` `R` package](https://cran.r-project.org/web/packages/petersenlab/index.html) [@R-petersenlab] on the Comprehensive R Archive Network (CRAN).
Several sections in this book come from @PetersenPrinciplesPsychAssessment.
I am also a co-author of the [`ffanalytics` `R` package](https://github.com/FantasyFootballAnalytics/ffanalytics) [@R-ffanalytics] that provides free utilities for downloading fantasy football projections and additional fantasy-relevant data, and for calculating projected points given your league settings.
## Accessibility {#sec-accessibility}
I strive to follow [principles of accessibility](https://bookdown.org/yihui/rmarkdown-cookbook/html-accessibility.html) [@Xie2024; @Xie2020_packages; archived at <https://perma.cc/8XJ9-Q6QJ>] to make the book content accessible to people with visual impairments and physical disabilities.
If there are additional ways I can make the content more accessible, please let me know.
## Example Syllabus {#sec-exampleSyllabus}
If you are interested in teaching a course using this textbook, here is an example syllabus based on my class: <https://isaactpetersen.github.io/psy-3170-2025-fall/syllabus.html>
## Acknowledgments {#sec-acknowledgments}
This book was supported by an OpenHawks Open Educational Resources grant program from the University of Iowa Libraries.
This work would not be possible without the important contributions of many people.
This book was made possible by the hard work of the package developers of the `nflverse` ecosystem of packages [@R-nflverse], who made football data available, including Sebastian Carl, Ben Baldwin, Lee Sharpe, Tan Ho, and John Edwards.
I thank Dr. Benjamin Motz, who provided consultation and many helpful resources based on his fantasy football statistics class.
I also thank key members of [FantasyFootballAnalytics.net](http://fantasyfootballanalytics.net), including Val Pinskiy, Andrew Tungate, Dennis Andersen, Adam Peterson, Jesse Kartes, and Chris Russo, who helped develop and provide fantasy football-related resources and who helped sharpen my thinking about the topic.
In particular, Andrew Tungate and Dennis Andersen helped develop the [`ffanalytics` `R` package](https://github.com/FantasyFootballAnalytics/ffanalytics) [@R-ffanalytics], which scrapes fantasy football projections from the web and calculates projections averaged across sources.
Andrew Tungate also made important additions to the [`ffanalytics` `R` package](https://github.com/FantasyFootballAnalytics/ffanalytics) [@R-ffanalytics] to allow computing fantasy points given projected (or actual) player statistics, which was necessary for conducting a [bootstrap simulation](#sec-simulationProjectedPointsBootstrapping) of players' projected fantasy points.
I am fortunate to work with such a talented, passionate, and creative team.
I also thank Professor Patrick Carroll, who taught me the value of statistics for answering important questions.
In addition, a special thanks to those who contributed to the book via comments, suggestions, and pull requests, including George Ellis ([\@MargareeMan](https://github.com/MargareeMan)) and Aidan Bowen ([\@bowenaidan](https://github.com/bowenaidan)).
Finally, I thank my wife who, in addition to designing the book cover, is a constant source of love and support.
\mainmatter