1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【2023年】プロ野球のパリーグの戦績でデータ分析 ver3 〜守備編〜

Posted at

はじめに

今回は守備の成績に注目してデータ分析を行います。

・前回の記事(投手編)

引用したサイト

勝率との相関係数のランキング

スクリーンショット 2023-10-19 13.47.27.png

順位 項目 相関係数
1位 刺殺 0.87
2位 守備率 0.71
3位 失策 -0.66
4位 併殺 -0.47
5位 捕逸 -0.44
6位 守機備会 0.15
7位 補殺 -0.07

※相関係数は小数点第3位で四捨五入しています。
相関係数の絶対数が大きい順に並べています。

各項目と勝率とのグラフ

・刺殺
AクラスとBクラスの差が歴然です。
Figure_勝率-刺殺.png

・守備率
Figure_勝率-守備率.png

・失策
Figure_勝率-失策.png

・併殺
Figure_勝率-併殺.png

・捕逸
Figure_勝率-捕逸.png

・守備機会
Figure_勝率-守備機会.png

・捕殺
Figure_勝率-補殺.png

環境構築

pip install pandas numpy seaborn matplotlib japanize-matplotlib

コード

データ分析に必要なライブラリをインポートします。

import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
import japanize_matplotlib

pd.set_option('display.max_columns', None)

# パリーグの守備・投手成績のCSVを読み込む
df = pd.read_csv('baseball/data/npb_2023_pacific_defencer.csv')
df_pitcher = pd.read_csv('baseball/data/npb_2023_pacific_pitcher.csv')

# グラフの凡例のチームカラー
team_colors = {
    'オリックス': 'navy',
    'ソフトバンク': 'yellow',
    '楽天': 'red',
    'ロッテ': 'black',
    '西武': 'blue',
    '日本ハム': 'cyan'
}

# チーム順位、勝率を追加
df['順位'] = ['2', '1', '5', '3', '4', '6']
df['勝率'] = [.507, .619, .458, .507, .496, .423]
df = df.sort_values(by='順位')

刺殺と勝率の分析のコードです。

column = '刺殺'
plt.figure(figsize=(10, 5))
sns.scatterplot(data=df, x=column, y='勝率', hue='チーム', palette=team_colors, s=100)
plt.title(f'{column}と勝率の関係')
plt.xlabel(column)
plt.ylabel('勝率')
plt.grid(True)
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left')
plt.tight_layout()
for i, row in df.iterrows():
    plt.text(
        row[column], row['勝率'], str(row['順位']), color='black',
        fontsize=10, ha='right', va='bottom'
    )
# 刺殺と勝率の平均値を示す線を追加
plt.axvline(df[column].mean(), color='red', linestyle='--', label=f'{column}の平均')
plt.axhline(df['勝率'].mean(), color='blue', linestyle='--', label='勝率の平均')
#  相関係数
correlation_coefficient = np.corrcoef(df[column], df['勝率'])[0, 1]
plt.text(0.1, 0.9, f'r: {correlation_coefficient:.2f}', transform=plt.gca().transAxes)
# 回帰直線
slope, intercept = np.polyfit(df[column], df['勝率'], 1)
x = np.linspace(min(df[column]), max(df[column]), 100)
y = slope * x + intercept
plt.plot(x, y, color='black', label=f'回帰直線: y = {slope:.2f}x + {intercept:.2f}', alpha=0.2)
plt.show()

セイバーメトリクスの指標を用いて、より詳しく分析していきます。

・RF:9イニング当たりの刺殺、補殺数によって守備を評価する指標(9 × (刺殺+補殺) / 投球回)
ロッテが最多となっています。
オリックスはK%(奪三振率)が高いためなのかリーグ最小の値となっています。
Figure_勝率-RF.png

・DEF:本塁打以外の打球を野球がどのくらいアウトにしたか(打席-安打-四球-死球-三振-失策)/(打席-本塁打-四球-死球-三振)
西武が最多となっており、ロッテが最少となっています。
あとの4チームは近い値のため、総合的な守備力は似たようなものかもしれません。
Figure_勝率-DER.png

・dWAR:守備による勝利への貢献度
Figure_勝率-dWAR.png

ソフトバンクは低いRFですが、DERはリーグ平均以上の値を記録しています。
日本ハムはソフトバンクより高いRFですが、DERはソフトバンクを下回っているので、K%を考えるとソフトバンクの方が守備力は高いと言えるでしょう。

防御率との相関係数

項目 相関係数
DER -0.63
RF 0.57
dWAR -0.35
補殺 0.50
刺殺 -0.34

おわりに

守備成績からは守備力をデータで測るのは難しいです。
項目を増やし、より多面的にデータを見られるようになれば改善はできるでしょう。
また、UZRはリーグによって値が変わるのでセパでUZRを比較するのは不適切だと思いますが、N岡vsG田論争が少し起きていますね。

おまけ

失策による失点率(RAE)と守備率のグラフです。
Figure_守備率-RAE.png

日本ハムは守備率が低く、失策による失点率が高いのでエスコンでの秋の守備特訓の効果を来季に楽しみにたいです。
ロッテは守備率がリーグ平均以下ですが、RAEがリーグ最少となって投手陣が踏ん張っているのでしょう。

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?