2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

R言語でゴルフのスコアをデータ分析してみる(2)【準備編Update】

2
Last updated at Posted at 2026-07-13

はじめに

前回の記事を投稿してから1年3ヶ月がたちました。ゴルフYouTuberとしての活動に力を入れていたため、こちらが疎かになっていました。心を入れ直して再開します。まずは、対象データと環境のアップデートから行います。

環境

・Mac mini M2 Pro
・macOS Tahoe 26.5.1
・RStudio 2026.06.0+242
・R version 4.6.1 (2026-06-24)

RStudioの見た目が少し変わっていました。

対象データ

対象日:2021年7月から2026年7月まで
ホールデータ:2538ホール
ラウンドデータ:141ラウンド

この1年3ヶ月でかなり増えました。

データ準備

最新データをNumbersに取り込んで、CSVファイルをエクスポートしました。
JoHoleData.csv

今後はこのファイルを分析対象とします。

最初の分析

最新データでまずは時系列で箱ひげ図を描きます。

【仮説】毎年上手くなっている

全てのラウンドスコアを年毎に箱ひげ図にしてみました。

ソースコード:

HoleData.R
#年ごとのScoreをまとめる
JoRoundData2021 <- subset(JoRoundData, subset = grepl("2021",Date) )
JoRoundData2022 <- subset(JoRoundData, subset = grepl("2022",Date) )
JoRoundData2023 <- subset(JoRoundData, subset = grepl("2023",Date) )
JoRoundData2024 <- subset(JoRoundData, subset = grepl("2024",Date) )
JoRoundData2025 <- subset(JoRoundData, subset = grepl("2025",Date) )
JoRoundData2026 <- subset(JoRoundData, subset = grepl("2026",Date) )

list = list( Year2021=JoRoundData2021$Score, Year2022=JoRoundData2022$Score, 
             Year2023=JoRoundData2023$Score, Year2024=JoRoundData2024$Score,
             Year2025=JoRoundData2025$Score, Year2026=JoRoundData2026$Score)

#箱ひげ図を作成
boxplot(list , col="Yellow",outline=T)

出力結果:

箱ひげ2026.png

なんだか2026年は幅が広いですが、中央値は確実に良くなってきています。

ここまでは前回と同じですが、おまけで「ローカル多項式回帰(Local Polynomial Regression)」を使い、141ラウンドの軌跡から滑らかな「成長曲線」を描いてみます。

ソースコード:

HoleData.R
# 曲線の描画
ggplot(JoRoundData, aes(x = RoundID, y = Score)) +
  geom_point(alpha = 0.4, color = "darkgreen") + 
  geom_smooth(method = "loess", se = TRUE, color = "blue", linewidth = 1.2) + 
  labs(
    title = "通算ラウンド数とスコアの推移(成長曲線)",
    x = "通算ラウンド数",
    y = "スコア"
  ) +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5)) +
  theme(
    text = element_text(family = "Hiragino Sans")
  )

出力結果:
ローカル多項式回帰.png

これをみると100ラウンドあたりで一時停滞していたことが分かります。

まとめ

最新データで分析する準備が整いました。次回からの分析に期待してください。週に一回ぐらいは投稿したいな。

2
0
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?