age_comps: Use MLEs to Calculate Similarity Scores for Batters

Description Usage Arguments Examples

View source: R/similarity-scores.R

Description

Use MLEs to Calculate Similarity Scores for Batters

Usage

1
age_comps(player, data, weights, years = 3, type = c("bat", "pit"))

Arguments

player

character. The name of the focus player, formatted as "Last; First M."

data

The dataset of MLEs. Should be the level_grp dataset from 'simScoresApp/b-comparison-app/bat_simscore_data.RData.

weights

Numeric, named vector. The names tell which variables to use for comparisons. The value tells the weight put on that variable when comparing.

years

numeric vector of length 1 or 2. If length 1, specifies how many years of statistcs to include. If length two, specifies the age range over which to compare (inclusive).

type

character. Whether these are batting or pitching data. Defaults to batting.

Examples

1
2
3
4
5
6
7
load("H:/simScoresApp/b-comparison-app/bat_simscore_data.RData")
wts <- c(position = .05, pa = .9, bb.perc = .66, k.perc = .84, iso = .84, babip = .23, obp = .92)
# comparing stats based on three most recent years
age_comps("Brown; Domonic L.", age_grp, wts, 3, "bat")
# comparing stats from age 24 to 26
age_comps("Brown; Domonic L.", age_grp, wts, c(24, 26), "bat")
# same thing!

guytuori/simScores documentation built on May 17, 2019, 9:29 a.m.