www.crosshyou.info

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

2022-01-01から1年間の記事一覧

都道府県別の個人企業経済調査(製造業と卸売業、小売業)のデータ分析5 - R言語のcaretパッケージで簡単クラシフィケーション

Unsplashのmicheile dot comが撮影した写真 www.crosshyou.info の続きです。今回はR言語でクラシフィケーション分析をしてみようと思います。 まず、caretパッケージの読み込みをします。 2019年と2020年のデータをトレーニング用のデータ、2021年のデータ…

読書記録 - 「地球外生命 アストロバイオロジーで探る生命の起源と未来」 小林憲正 著 中公新書

地球外生命 アストロバイオロジーで探る生命の起源と未来 (中公新書) 作者:小林憲正 中央公論新社 Amazon 読みながらワクワクしました。 火星や金星、木星の衛星のエウロパ、土星の衛星のタイタンやエンケラドゥスなどにもしかしたら生命が存在するかもしれ…

都道府県別の個人企業経済調査(製造業と卸売業、小売業)のデータ分析4 - R言語のinferパッケージを使い、平均値の信頼区間を視覚化する。

UnsplashのSimon Bergerが撮影した写真 www.crosshyou.info の続きです。 今回は、R言語のinferパッケージを使って、opm(営業利益率)の平均値の信頼区間を算出してみます。 まずは、group_by()とsummarize()とmean()を使って、製造業のopm、卸売小売業のopm…

都道府県別の個人企業経済調査(製造業と卸売業、小売業)のデータ分析3 - R言語のarrange()関数で都道府県別ランキング

UnsplashのPete Wongが撮影した写真 www.crosshyou.info の続きです。前回はデータをグラフにしてみました。 今回は都道府県別のランキングを見てみましょう。 まずは、製造業のrevenueランキングです。filter()関数で製造業にしてから、arrange()関数とdesc…

都道府県別の個人企業経済調査(製造業と卸売業、小売業)のデータ分析2 - R言語のggplot2パッケージで5種類のよく使うグラフを描く

UnsplashのAlex Basovが撮影した写真 www.crosshyou.info の続きです。 今回はデータをグラフにして、どんなデータなのかを把握してみたいと思います。 はじめに変数がどんなデータがあるかを確認したいと思います。 summary()関数で一覧してみます。 year_c…

都道府県別の個人企業経済調査(製造業と卸売業、小売業)のデータ分析1 - R言語にデータを取り込む

UnsplashのSingle.Earthが撮影した写真 今回は都道府県別の個人企業経済調査のデータの分析をしてみたいと思います。 (振り返ってみると、2021年3月にもこのデータを分析していましたが、自分の中ではすっかり忘れていました。) 政府統計の総合窓口、www.e-s…

OECD Social spending data analysis 6 - Linear regression using R

UnsplashのWaranont (Joe)が撮影した写真 www.crosshyou.info This post is following of the above post. In this post I will do linear regression anaysis using R. Firstly, I will start with one numerical explanatory variable. Above code shows t…

OECD social spending data analysis 5 - Bootstrapping with R infer package

UnsplashのSonika Agarwalが撮影した写真 www.crosshyou.info This post is following of the above post. In this post, I will do bootstrapping with R infer package. Suppoese df2$priv_pc_gdp is population. So true mean of priv_pc_gdp is The true…

読書記録 - 「スピノザ - 読む人の肖像」 國分功一郎 著 岩波新書

スピノザ――読む人の肖像 (岩波新書 新赤版) 作者:國分 功一郎 岩波書店 Amazon スピノザという哲学者が昔、オランダに住んでいました。 彼は、聖書やデカルトの方法序説などをとてもよく読んで、彼独自の新しい哲学を作ったようです。 私には難しくて、2割も…

OECD Social spending data analysis 4 - Calculating Confidence Interval using R

UnsplashのArda Demirkaynakが撮影した写真 www.crosshyou.info This post is following of above post. In the previous post, I made some visualizations with R ggplot2 package. In this post. In this post I will calculate confidence intervals. Fi…

OECD Social spending data analysis 3 - Data Visualization with 5 Named Graphs (5NG) using R

UnsplashのAlicia Steelsが撮影した写真 www.crosshyou.info This post is following of above post.In the previous post, I made a dataframe for data analysis, named 'df2'.Now, let's start data analysis with data visualization.I will make 5 Name…

OECD Social spending data analysis 2 - Using filter(), select(), inner_join(), rename() function with R to make a dataframe to analyze.

UnsplashのMilos Prelevicが撮影した写真 www.crosshyou.info This post is following of the above post. In the previous post, I load OECD Social spending data into R. I also load country ISO code and continent name data like below CSV file. I …

OECD Social spending data analysis 1 - Load CSV file data using R, read_csv() function.

UnsplashのAlexander Schimmeckが撮影した写真 In this post I will analyze OECD Social spending data using R. OECD (2022), Social spending (indicator). doi: 10.1787/7497563b-en (Accessed on 26 November 2022) This indicator is measured as a pe…

都道府県別の被服及び履物費のデータの分析6 - R言語のplmパッケージでパネルデータ分析。First Difference, Fixed Effect, Random Effect Estimator.

UnsplashのZoltan Tasiが撮影した写真 www.crosshyou.info の続きです。 前回はR言語のplmパッケージを使ってパネルデータフレームを作成し、model = "pooling" にして普通のクロスセクションで回帰分析をしました 今回は、First Differenced Estimator, Fix…

都道府県別の被服及び履物費のデータの分析5 - R言語でパネルデータ分析。plmパッケージのplm()関数を使う

UnsplashのAndrey Andreyevが撮影した写真 www.crosshyou.info の続きです。 今回は、R言語でパネルデータの分析をします。 Using R for Introductory Econometrics 作者:Heiss, Florian Independently Published Amazon こちらの本を参考にしてやってみます…

都道府県別の被服及び履物費のデータの分析4 - R言語で回帰分析。カテゴリーデータを説明変数に加える。重回帰分析。

UnsplashのGwen Weustinkが撮影した写真 www.crosshyou.info の続きです。 前回はwear_shoeを被説明変数、wariaiを説明変数にして単回帰分析をしました。 今回はもう一つ説明変数を加えてみます。カテゴリーデータを加えてみましょう。 まず、カテゴリーデー…

都道府県別の被服及び履物費のデータの分析3 - R言語で回帰分析。まずは単回帰分析。15~64歳の人口割合を説明変数にする。

UnsplashのBoris Smokrovicが撮影した写真 www.crosshyou.info の続きです。 今回はR言語で回帰分析をしてみます。 被説明変数は、wear_shoe: 被服及び履物費です。回帰分析をはじめる前にwear_shoeとその他の説明変数の候補との相関関係を確認しておきまし…

読書記録 - 「生物学探偵セオ・クレイ 街の狩人」 アンドリュー・メイン著 ハヤカワ・ミステリ文庫

生物学探偵セオ・クレイ 街の狩人 (ハヤカワ・ミステリ文庫) 作者:アンドリュー メイン 早川書房 Amazon 生物学探偵セオ・クレイのシリーズ2冊目です。探偵というよりは、シリアルキラー・ハンターです。街の狩人というタイトルのとおり今回はロスアンゼルス…

都道府県別の被服及び履物費のデータの分析2 - R言語でグラフを描く。The Five Named Graphs でデータを視覚化する。

UnsplashのPierre Van Crombruggheが撮影した写真 www.crosshyou.info の続きです。 今回は、Chapter 2 Data Visualization | Statistical Inference via Data Science (moderndive.com) を参考にしてR言語のggplot2パッケージを使っていくつかグラフを描き…

都道府県別の被服及び履物費のデータの分析1 - R言語にCSVファイルのデータを読み込む。

UnsplashのNico Knaackが撮影した写真 今回は、都道府県別の被服及び履物費のデータを分析してみようと思います。 データは、政府統計の総合窓口(www.e-stat.go.jp)から取得しました。 被服及び履物費を被説明変数として、人口密度や15~64歳人口割合、1人当…

J. Leagueのデータの分析 - R言語で「攻撃は最大の防御なり」か「防御は最大の攻撃なり」かを調べる。

UnsplashのWesley Tingeyが撮影した写真 今回は、J. Leagueのデータを分析してみます。勝ち点と得点、失点の関係を調べます。 まず、データをJ. Leagueの公式サイトから取得しました。 J. League Data Site (j-league.or.jp) Webスクレイピングできればいい…

読書記録 - 「人類と病 - 国際政治から見る感染症と健康格差」 詫磨佳代 著 中公新書

人類と病-国際政治から見る感染症と健康格差 (中公新書 2590) 作者:詫摩 佳代 中央公論新社 Amazon 人類が感染症や生活習慣病とどのように対処してきたのかをまとめた本です。 中世のペスト(黒死病)から現在の新型コロナウイルス、糖尿病などの生活習慣病な…

OECD Researchers data analysis 6 - Multiple Linear Regression in R

UnsplashのEvi T.が撮影した写真 www.crosshyou.info This post is following of the above post.In the previous post, I did sinple linear regression, it menas there is only one explanatory vatiable. In this post I will do multiple linear regres…

OECD Researchers data analysis 5 - Simple Linear Regression with one numerical variable in R, ModernDive way

UnsplashのMadara Parmaが撮影した写真 www.crosshyou.info This post is following of the above post.In this post, I will do linear regression analysis. To do this, I make a small(subset) data frame. Let's check what TIME has the most observat…

OECD Researchers data analysis 4 - Sorting dataframe by column in R

UnsplashのKarsten Würthが撮影した写真 www.crosshyou.info This post is following of the above post. In this post, let's sort dataframe by variables. The smallest TOT_1000EMPLOTED observation is CHL 2009. The largest TOT_1000EMPLOYED observa…

OECD Researchers data analysis 3 - 5 Named Graphs in R

UnsplashのPhong Nguyenが撮影した写真 www.crosshyou.info This post is following of the above post.In this post I will create 5 names graphs in R. I refer to Chapter 2 Data Visualization | Statistical Inference via Data Science (moderndive.c…

OECD Researchers data analysis 2 - Converting long format dataframe to wide format dataframe and merge two dataframes with R

UnsplashのSakuraが撮影した写真 www.crosshyou.info This post is floowing of the above post. Let's explore gdp dataframe. gdp dataframe has more LOCATION than researcher dataframe. gdp dataframe INDICATOR has only one calue, GDP. So I can re…

読書記録 - 「生物学探偵セオ・クレイ 森の捕食者」 アンドリュー・メイン著 ハヤカワ・ミステリ文庫

生物学探偵セオ・クレイ 森の捕食者 (ハヤカワ・ミステリ文庫) 作者:アンドリュー メイン 早川書房 Amazon 著者は有名なマジシャンだそうです。才能がいっぱいあるのですね。 主人公のセオ・クレイは生物工学(原著を確認していなですが、たぶん、bioinfomati…

OECD Researchers data analysis 1 - Load CSV file into R with read_csv() function.

UnsplashのMarek Piwnickiが撮影した写真 In this post, I will analyze OECD Researchers data. Researchers are professionals engaged in the conception or creation of new knowledge, products, processes, methos and systems, as well as in the man…

都道府県別の経済構造実態調査のデータの分析6 - R言語のlm()関数で回帰分析をして、ggplot() + geom_point() + geom_abline()で散布図に回帰直線を重ねる

UnsplashのClement Souchetが撮影した写真 www.crosshyou.info の続きです。 前回はANOVA分析をしてみました。今回は回帰分析をしてみようと思います。 pc_val: 一人当たりの売上高を被説明変数にして回帰分析をしてみます。 まず、p_male304050: 30代40代50…