www.crosshyou.info

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

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

OECD Purchasing power parities (PPP) data analysis 4 - Hierarchical Clustering and K-means Clustering using R.

Photo by Mylon Ollila on Unsplash www.crosshyou.info This post is following of the above post. In this post, I will do clustering. First, I use hierarchial clustering. I make a matrix for clustering. I use 2018 and 2019 data. Then, I use d…

OECD Purchasing power parities (PPP) data analysis 3 - relationship with GDP data and PPP. Some countries have positive correlation and some have negative.

Photo by Quino Al on Unsplash www.crosshyou.info This post is following of the above post.I have GDP data file like below, which I downloaded OECD web site. I am going to merge this data to previous ppp data. Firstly, I upload this CSV fil…

OECD Purchasing power parities (PPP) data analysis 2 - TUR, MEX and ISL have volatile PPP and LUX, BEL and CAN have stable PPP

Photo by Drew Bae on Unsplash www.crosshyou.info This post is following of the above post. In this post, let's make some graphs. Firstly, let's see year vs. ppp. I use plot() function. We see 2 countries have relatively high ppp than oters…

読書記録 - 「新型コロナと向き合う - 「かかりつけ医」からの提言」 横倉義武 著 岩波新書

新型コロナと向き合う: 「かかりつけ医」からの提言 (岩波新書 新赤版 1900) 作者:横倉 義武 岩波書店 Amazon 著者は2012年から2020年6月まで日本医師会会長をしていました。 日本医師会からみた新型コロナの対応が第1章で時系列的に書かれていて、第2章でそ…

OECD Purchasing power parities (PPP) data analysis 1 - read CSV file with read_csv() function in R and make a dataframe to analyze.

Photo by Andrew Svk on Unsplash In this post, I will analyze OECD Purchasing power parities (PPP). From the OECD website, I got below CSV file. I analyze those data with R. Firstly, I load tidyvesr package. Let's load the CSV file with rea…

都道府県別の共働き世帯割合のデータの分析6 - R言語のcarパッケージのlinearHypothesis()関数で回帰分析のF検定

Photo by Kyle on Unsplash www.crosshyou.info の続きです。 今回は、carパッケージのlinearHypothesis()関数というものを知ったので、忘れないように使ってみたいと思います。 前回は、tomo: 共働き世帯割合(%)を被説明変数にして、2期間のパネルデータでF…

都道府県別の共働き世帯割合のデータの分析5 - 2010年と2015年の2期間のデータで回帰分析する。パネルデータフレームの作成とFirst Difference Estimator

Photo by Ahsen Sunay on Unsplash www.crosshyou.info の続きです。 前回は2015年だけのデータを使って回帰分析しました。 今回は2010年のデータも使って回帰分析してみます。 まず、2010年と2015年だけのデータフレームを作成します。 d10というダミー変数…

都道府県別の共働き世帯割合のデータの分析4 - R言語で重回帰分析をする。Breush-Pagan検定やWhite検定のspecial formで均一分散の検定をする。

Photo by Gavin Spear on Unsplash www.crosshyou.info の続きです。 前回は、tomo: 共働き世帯割合(%)をunem: 完全失業率(%)で回帰分析してみました。 2015年だけのデータを使うと、 tomo = 51.19 - 16.66 x log(unem) + u というモデルが推計されました。 …

都道府県別の共働き世帯割合のデータの分析3 - 共働き世帯割合を失業率で回帰分析する。失業率が高いほど、共働き世帯割合は低い。

Photo by Gustavo Zambelli on Unsplash www.crosshyou.info の続きです。 今回は、tomo: 共働き世帯割合(%)を被説明変数、unem: 完全失業率(%)を説明変数にして回帰分析をしてみようと思います。 R言語のlm()関数を使います。 まずは、2015年だけのデータで…

都道府県別の共働き世帯割合のデータの分析2 - 共働き世帯割合は年々低下傾向で、東京や大阪が低く、山形や福井が高い。

Photo by Alexander Andrews on Unsplash www.crosshyou.info の続きです。 まず、年ごとに共働き世帯割合がどのように変化しているのかを見てみます。 R言語のplot()関数を使いました。 年と経るごとに共働き世帯割合が減少していることがわかります。 この…

読書記録 - 「保守主義とは何か 反フランス革命から現代日本まで」 宇野重規 著 中公新書

保守主義とは何か - 反フランス革命から現代日本まで (中公新書) 作者:宇野 重規 中央公論新社 Amazon 保守主義とは、進歩主義に対抗するもの。 現在は「進歩」に対して懐疑的な感情も多くなっているので、それに対応して保守主義も曖昧な感じになっている。…

都道府県別の共働き世帯割合のデータの分析1 - R言語のread_csv()関数でCSVファイルのデータを読み込む。

Photo by Riccardo Chiarini on Unsplash 今回は都道府県別の共働き世帯割合のデータを分析してみようと思います。 データは、政府統計の総合窓口(www.e-stat.go.jp)から取得します。 まず、地域を選択します。 データを選択します。 共働き世帯割合の他に関…

OECD Trust in government data analysis 8 - Trust is government cannot be explained simply by per capita GDP, inflation and long-term unemployment.

Photo by Rob Wicks on Unsplash www.crosshyou.info This post is following of above post. In the previous post I used only JPN data.Let's use whole data in this post.Firstly, I make a multiple linear regression model by year. Dependent varia…

OECD Trust in government data analysis 7 - In Japan, Trust in government and log(per capita GDP) has some relationship.

Photo by Zoltan Tasi on Unsplash www.crosshyou.info This post is following above post. I will add interst rate data and long term unpenployment data. longterm unenployment is "number of unenployee more than 12 months / number of all unenpo…

読書記録 - 「中国名文選」 興膳宏 著 岩波新書

中国名文選 (岩波新書) 作者:興膳 宏 岩波書店 Amazon 漢文の名文を12章で12人分紹介しています。 印象に残ったのは、この紹介された12人の多くが左遷されたり不遇なときを過ごしたことがあることです。

OECD Trust in government data analysis 6 - Multiple linear regression using R - log(per capita GDP) and inflation rate and iso.

Photo by Jim Cooke on Unsplash www.crosshyou.info This post is following of the above post. So far previous posts, GDP nor per capita GDP cannot explain Trust in governmnet very well. I will add more variables. I have CPI, inflation data l…

OECD Trust in government data analysis 5 - Simple linear regression using R - Trust in governance and per capita GDP, log(per capita GDP)

Photo by Annie Spratt on Unsplash www.crosshyou.info This post is following of the above post. 5. Independent variable = capi, by year Almost year except for 2010 have positive coefficientt. But only 2017 is statisticaly significant. 6. In…

OECD Trust in government data analysis 4 - Simple linear regression using R - Trust in government ~ GDP, log(GDP).

Photo by Dulana Kodithuwakku on Unsplash www.crosshyou.info This post is following of the above post. Let's make log(capi) as l_capi. Let's make a scatter plot for trust and l_capi. It seems there is not clear relationship. Then, I load br…

OECD Trust in government data analysis 3 - Correlation between Trust in government and GDP, per capita GDP using R.

Photo by Sunil Naik on Unsplash www.crosshyou.info This post is following of the above post. I have another data file like below This is GDP and per capita GDP data.I will merge this data with trust in government data. First, I load this f…

OECD Trust in government data analysis 2 - ANOVA analysis shows Trust in government are different by countries. ITA has the lowest, CAN has the highest.

Photo by SGR on Unsplash www.crosshyou.info This post is following of the above post. In the previous post, I loaded OECD Trust in government data.Let's see overall histogram of the data. I use hist() function. It looks like normal distrib…

OECD Trust in government data analysis 1 - Using R read_csv() function to load CSV file data.

Photo by Taun Stewart on Unsplash I this series of posts, I will analysis OECD data, "Trust in governmet".I got below CSV file from General government - Trust in government - OECD Data I use R to analyze this data. Firstly, I load tidyvers…

都道府県別の工業用水量のデータ7 - 都道府県別にグループ分けして回帰分析する。

Photo by Mark X. on Unsplash www.crosshyou.info の続きです。 今回が都道府県別にグループ分けしてから回帰分析をしてみます。 まず、df_lmというデータフレーム(正しくはtibble)を作成して、その中に回帰分析の結果を格納しました。 切片をみてみましょ…

都道府県別の工業用水量のデータの分析6 - R言語のbroomパッケージのtidy()関数で効率よくlm()関数で回帰分析をする。

Photo by Markus Spiske on Unsplash www.crosshyou.info の続きです。 今回もR言語のlm()関数で回帰分析をしていこうと思います。今回はbroomパッケージのtidy()関数を使ってみます。 まずは、broomパッケージを読み込みます。 broomパッケージのtidy()関数…

都道府県別の工業用水量のデータの分析5 - R言語のlm()関数で回帰分析をする。(クロスセクション・データ)

Photo by Tanya Nevidoma on Unsplash www.crosshyou.info の続きです。 今回はR言語のlm()関数を使って回帰分析をしてみようと思います。 まずは、l_waterをl_kachiで回帰分析してします。 l_water: 工業用水量(m3/日)を対数変換したもの l_kachi: 製造業付…

都道府県別の工業用水量のデータの分析4 - R言語のいろいろなパッケージで相関係数マトリックスを作成する。

Photo by Daniel Seifried on Unsplash www.crosshyou.info の続きです。 今回は、各変数間の相関関係をみてみましょう。 2014年のデータを使ってみてみます。 まずは、調べる変数名の確認です。対数変換した変数で調べます。 names()関数でデータフレームdf…

都道府県別の工業用水量のデータの分析3 - R言語でt検定 海の無い県は明らかに工業用水量の使用量は少ない。

Photo by Jerry Adney on Unsplash www.crosshyou.info の続きです。 前回の分析で、どうやら海の無い県は工業用水の使用料が海のある県よりも少ないようです。 これを統計学的に検証してみましょう。 まず、2014年の海の無い県のwater_kachi: 製造業付加価…

都道府県別の工業用水量のデータの分析2 - 千葉県が一番多く工業用水を使い、奈良県は一番使わない。

Photo by Martina Mainetti on Unsplash www.crosshyou.info の続きです。 前回は工業用水量のデータをはじめ総人口や県内総生産額などのデータが対数正規分布になっていることを確認しました。 まず、codeだけではどれがどの都道府県なのかわからないので、…

都道府県別の工業用水量のデータの分析1 - R言語にデータを取り込む。

Photo by Joanna Huang on Unsplash 今回は、都道府県別の工業用水のデータを分析してみようと思います。 データは、政府統計の総合窓口(www.e-stat.go.jp)から取得しました。 47の都道府県を選択します。 工業用水量のデータの他に総人口、県内総生産額、製…

読書記録 - 「怨霊とは何か 菅原道真・平将門・崇徳院」 山田雄司 著 中公新書

怨霊とは何か - 菅原道真・平将門・崇徳院 (中公新書) 作者:山田 雄司 中央公論新社 Amazon 怨霊とは死ぬときに深い怨念を抱いて死んで、現世の世界に祟りをもたらす存在です。 菅原道真・平将門・崇徳院が日本の三大怨霊だそうです。 崇徳院は知らなかった…

OECD Business confidence Index(BCI) data analysis 8 - BCI and GDP Growth are positively correlated.

Photo by J Lee on Unsplash www.crosshyou.info This post is following of above post.In the previous post, I made panel data dataframe.Let's analyze this. Firstly, let's see correlation. g_gdp and g_capi are highly correlated. bci_sd are neg…