team.batting.00to08: MLB Team Batting Statistics, 2000-2008

Description Usage Format Details Source Examples

Description

This data set contains statistics on team batting between 2000 and 2008.

Usage

1

Format

A data frame with 270 observations on the following 13 variables.

teamID

a character vector

yearID

a numeric vector

runs

a numeric vector

singles

a numeric vector

doubles

a numeric vector

triples

a numeric vector

homeruns

a numeric vector

walks

a numeric vector

stolenbases

a numeric vector

caughtstealing

a numeric vector

hitbypitch

a numeric vector

sacrificeflies

a numeric vector

atbats

a numeric vector

Details

This data contains aggregate offensive statistics for each team in Major League Baseball between 2000 and 2008. It is used as an example in the book "R in a Nutshell" from O'Reilly Media.

Source

The data was derived from the Baseball Databank database, downloadable from http://www.baseball-databank.org.

Examples

1
2
3
4
5
6
7
8
data(team.batting.00to08)
attach(team.batting.00to08)
runs.mdl <- lm(
  formula=runs~singles+doubles+triples+homeruns+
    walks+hitbypitch+sacrificeflies+
    stolenbases+caughtstealing,
  data=team.batting.00to08)
summary(runs.mdl)

Example output

Loading required package: nutshell.bbdb
Loading required package: nutshell.audioscrobbler

Call:
lm(formula = runs ~ singles + doubles + triples + homeruns + 
    walks + hitbypitch + sacrificeflies + stolenbases + caughtstealing, 
    data = team.batting.00to08)

Residuals:
    Min      1Q  Median      3Q     Max 
-71.902 -11.828  -0.419  14.658  61.874 

Coefficients:
                 Estimate Std. Error t value Pr(>|t|)    
(Intercept)    -507.16020   32.34834 -15.678  < 2e-16 ***
singles           0.56705    0.02601  21.801  < 2e-16 ***
doubles           0.69110    0.05922  11.670  < 2e-16 ***
triples           1.15836    0.17309   6.692 1.34e-10 ***
homeruns          1.47439    0.05081  29.015  < 2e-16 ***
walks             0.30118    0.02309  13.041  < 2e-16 ***
hitbypitch        0.37750    0.11006   3.430 0.000702 ***
sacrificeflies    0.87218    0.19179   4.548 8.33e-06 ***
stolenbases       0.04369    0.05951   0.734 0.463487    
caughtstealing   -0.01533    0.15550  -0.099 0.921530    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 23.21 on 260 degrees of freedom
Multiple R-squared:  0.9144,	Adjusted R-squared:  0.9114 
F-statistic: 308.6 on 9 and 260 DF,  p-value: < 2.2e-16

nutshell documentation built on May 1, 2019, 10:08 p.m.