Rで何かをしたり、読書をするブログ

政府統計の総合窓口のデータや、OECDやUCIやのデータを使って、Rの練習をしています。ときどき、読書記録も載せています。

UCI Machine Learning Repository の Obesity データの分析4 - 探索的データ分析: EDA (Exploratory Data Analysis) の実践その3

www.crosshyou.info

の続きです、前々回、前回に続き、探索的データ分析: EDA (Exploratory Data Analysis) をしていきます。

obesity と CH2O です。How much water do you drink daily? という質問なので、水を一日にどれくらい飲むか? です。

normal weight, insufficient weight の人のほうが少ないことがわかります。

 

次は、obesity と SCC です。これは、Do you monitor the calories you eat daily? です、

食べるときにカロリーをチェックしているかどうかですね。

obesity のタイプの人たちはほとんどチェックしていないですね。

 

次は、obesity と FAF です。これは、How often do you have physical activity? です。運動をどのくらいしているかですね。

obesity type III の人は、あんまり運動をしていないようです。

 

次は、obesity と TUE です。これは、How much time do you use technological devices such as cell phone, videogames, television, computer and others?   携帯電話、ビデオゲーム、テレビ、コンピューターなどの電子機器をどのくらい使うか、です。

obesity type II の人はあまり使わないようです。

 

次は obesity と CALC です。これは、How often do you drink alcohol? です。お酒をどのくらい頻繁に飲むか、です。

obesity type III の人は no がほとんどいないです。

 

次は obesity と MTRANS です。これは、Which transportation do you usually use? です。

obesity type III の人はほとんど public transportation ですね。

 

以上、3回にわたり探索的データ分析: EDA (Exploratory Data Analysis) を実践しました。

obesity type III はかなり特徴的ですね。

今回は以上です。

次回は

www.crosshyou.info

です。

 

はじめから読むには、

www.crosshyou.info

です。

 

今回のコードは以下になります。
# obesity と CH2O
df |> 
  mutate(obesity = reorder(obesity, CH2O)) |> 
  ggplot(aes(x = CH2O, y = obesity, group = obesity)) +
  geom_boxplot(aes(fill = obesity)) +
  theme_minimal() +
  theme(legend.position = "none")
#
# obesity と SCC
df |> 
  ggplot(aes(x = obesity, fill = SCC)) +
  geom_bar() +
  theme_minimal()
#
# obesity と FAF
df |> 
  mutate(obesity = reorder(obesity, FAF)) |> 
  ggplot(aes(x = FAF, y = obesity, group = obesity)) +
  geom_boxplot(aes(fill = obesity)) +
  theme_minimal() +
  theme(legend.position = "none")
#
# obesity と TUE
df |> 
  mutate(obesity = reorder(obesity, TUE)) |> 
  ggplot(aes(x = TUE, y = obesity, group = obesity)) +
  geom_boxplot(aes(fill = obesity)) +
  theme_minimal() +
  theme(legend.position = "none")
#
# obesity と CALC
df |> 
  ggplot(aes(x = obesity, fill = CALC)) +
  geom_bar() +
  theme_minimal()
#
# obesity と MTRANS
df |> 
  ggplot(aes(x = obesity, fill = MTRANS)) +
  geom_bar() +
  theme_minimal()
#

 

(冒頭の画像は、Bing Image Creator で生成しました。プロンプトは、Natural landscape of long wide green grass field, there are a lot of purple iris flowers and close up of one pink carnation flower, under the blue sky, photo です。)