This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load some packages | |
library(dplyr) | |
library(ggplot2) | |
library(mgcv) | |
library(janitor) | |
library(metR) | |
# have Statcast data through games of April 5, 2024 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Retrosheet Package - Comparing Count Rates for Two Seasons" | |
format: html | |
editor: visual | |
--- | |
Load packages for this particular run. | |
```{r} | |
#| message: FALSE | |
library(abdwr3edata) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# live version of Shiny app | |
# https://bayesball.shinyapps.io/fg2023_discipline/ | |
library(shiny) | |
library(mlbplotR) | |
library(dplyr) | |
library(ggplot2) | |
library(readr) | |
# data work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Zach Wheeler 2023 NCS" | |
format: html | |
editor: visual | |
--- | |
Load in necessary packages: | |
```{r} | |
library(baseballr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
player_function_lb <- function(player_id){ | |
# uses LearnBayes package to simulate from | |
# multilevel model | |
library(dplyr) | |
library(ggplot2) | |
library(Lahman) | |
library(LearnBayes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# read in two functions | |
source("generate_runs.R") | |
source("retro_game_work.R") | |
library(dplyr) | |
# Phillies game plays on April 16, 2023 | |
plays <- c("HR", "1B", "BB", "BB", "1B", "OUT", "1B", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(readr) | |
library(dplyr) | |
library(brms) | |
# read in data from Github site | |
all_data <- read_csv("https://raw.githubusercontent.com/bayesball/HomeRuns2021/main/ten_seasons_retro_hr.csv") | |
# remove all parks that are either dome or retractable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plot_bivar_norm <- function(mx, my, sx, sy, r){ | |
require(ggplot2) | |
logbinorm <- function (x, y, par) { | |
m <- par$m | |
v <- par$v | |
zx <- (x - m[1]) / sqrt(v[1, 1]) | |
zy <- (y - m[2]) / sqrt(v[2, 2]) | |
r <- v[1, 2] / sqrt(v[1, 1] * v[2, 2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "ChatGPT Examples" | |
format: html | |
editor: visual | |
--- | |
## Collecting Cards | |
_Write R function to illustrate baseball card collection problem._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reference | |
# https://billpetti.github.io/baseballr/articles/baseballr.html#follow-the-sportsdataverse-on-twitter-and-star-this-repo | |
library(baseballr) | |
# ----------------------------------------------------- | |
# Retrosheet data | |
# ----------------------------------------------------- | |
# acquire retro play-by-play data for seasons 2020:2022 |
NewerOlder