www.crosshyou.info

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

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

OECD Household disposable income data analysis 5 - simple linear regression analysis using R

Photo by V Srinivasan on Unsplash www.crosshyou.info This post is following of the above post. In this post, let's do simple linaer regression anaysis using R. First, I use df_country data frame. Coefficients of avg_gr_us is -1.002e-04, it…

OECD Household disposable income data analysis 4 - make a data frame by country and by year using R.

Photo by Olga Tsai on Unsplash www.crosshyou.info This post is following of above post. In this post, let's make average value data frame by country and by year. First, I make a data frame for average value by country using group_by() func…

OECD Household disposable income data analysis 3 - making some graphs using R.

Photo by Lorena Schmidt on Unsplash www.crosshyou.info This post is following of above post. In this post, let's make some graphs to understand data distributions, data relationship. Fisrt, a histgram of gr_us. ecdf plot of gr_us. boxplot …

OECD Household disposable income data analysis 2 - using filter(), select(), inner_join() functions to make a date frame more analyzable.

Photo by CHUTTERSNAP on Unsplash www.crosshyou.info This post is following of above post. In the previous post, we made a dafa frame called a "df". We see there are two values in subject, GROSSADJ and NET, two values in measure, AGRWTH and…

OECD Household disposable income data analysis 1 - import data into R

Photo by Bob Brewer on Unsplash In this post, I will analyze OECD Household disposable income. Household accounts - Household disposable income - OECD Data I got below CSV file from the web site. I will import this data into R. First of al…

都道府県別の書籍・文房具販売額データの分析5 - R言語のstargazer()関数で整った回帰分析の結果の表を作る。

Photo by Matt Anderson on Unsplash www.crosshyou.info の続きです。 前回の続きで、今度は交差項を含んだ回帰分析をします。 まずは、per_shobuをincとその他で回帰分析します。 p-valueが1.387e-13とかなり小さいの有意なモデルです。Multiple R-sauared…

都道府県別の書籍・文房具販売額データの分析4 - R言語で回帰分析。1人当たり県民所得が増えると1人当たり書籍・文房具販売額も増える。

Photo by Sam Mgrdichian on Unsplash www.crosshyou.info の続きです。 前回までの分析で気づいたことは、1人当たり県民所得が大きいところは1人当たりの書籍・文房具販売額も大きいということです。 相関係数を確認してみると、 というように相関係数は0.8…

都道府県別の書籍・文房具販売額データの分析3 - R言語でデータを可視化する

Photo by Thor Alvis on Unsplash www.crosshyou.info の続きです。 今回はR言語でデータを可視化します。 ggplot2パッケージでのチャートをいくつか作ってみます。 per_shobu: 1人当たり年間書籍・文房具販売額(千円)のチャートです。geom_barでバーチャー…

都道府県別の書籍・文房具販売額データの分析2 - R言語で基本的な記述統計量を表示する

Photo by Jan Haerer on Unsplash www.crosshyou.info の続きです。 今回は各変数の基本的な記述統計量をみてみます。 最小値はmin()関数、最大値はmax関数、平均値はmean()関数、中央値はmedian()関数、標準変数はsd()関数、パーセンタイル値は、quantile()…

都道府県別の書籍・文房具販売額データの分析1 - R言語でCSVファイルのデータを読み込む

Photo by Wil Stewart on Unsplash 今回は都道府県別の書籍・文房具の販売金額のデータを分析しようと思います。 データは政府統計の総合窓口、e-statから取得しました。(www.e-stat.go.jp) 47都道府県を選択して、 総人口、15~64歳の男性の割合、15~64歳の…

OECD Road accidents data analysis 5 - Time Series Data Regression using R

Photo by JJ Ying on Unsplash www.crosshyou.info This post is following of above post.In this post, I woll do time series data regression using R , dynlm package. Firstly, I wll make time series data. Then, let's see how data is looking. Le…

OECD Road accidents data analysis 4 - Regression analysis Death per Habitant on Accident Number

Photo by Yoksel Zok on Unsplash www.crosshyou.info This post is following of above post.In the previous post, we see it is better to convert all variables to logarithm to make more normal distribition looking.So, let's make new variables.…

OECD Road accidents data analysis 3 - make a histogram with ggplot() + geom_histogram(). Log conversion makes better looking histogram.

Photo by Robert Lukeman on Unsplash www.crosshyou.info This post is following og above post. We have five combinations for value, 1. ACCI & NBR 2. DEATH & HAB 3. DEATH & VEH 4. DEATH & NBR 5. INJURE & NBR So, I will make five sub data fram…

東京都の職業別のコロナ感染者はどうなっているのか?

コロナ感染者が日ごとに増加していますね。。 年齢別では30代以下が7割との報道がありましたが、 感染者急増 30代以下が7割超 - Yahoo!ニュース 職業別ではどうなっているのでしょうか? 気になったので、東京都のデータで調べてみました。 上の画像の東京都…

OECD Road accidents data analysis 2 - R summary() function is very useful to see a data frame statistics.

Photo by Clyde RS on Unsplash www.crosshyou.info This post is following of above post.In the previous post, I made a data frame named "df".Let's see the data frame in detail. I will use summary() function in R. Before using summary() funct…

OECD Road accidents data analysis 1 - import CSV file data using R and make a data frame tidy.

Photo by Stephen Leonardi on Unsplash In this post, I will analyze OECD Road accidents data. The CSV file I donwloaded from the OECD web site(Transport - Road accidents - OECD Data) is like below. Let' analuze this data using R.Firstly, I …

都道府県別の後期高齢者医療制度被保険者実態調査のデータ分析6 - R言語のstargazer()関数で回帰分析の結果を美しく出力する。

Photo by Taisiia Shestopal on Unsplash www.crosshyou.info の続きです。 今回はlm()関数で回帰分析をして、その結果をstargazer()関数で美しく出力してみたいと思います。 shotoku_1617: 所得の2016年から2017年の変化幅を被説明変数にして、その他の変数…

都道府県別の後期高齢者医療制度被保険者実態調査のデータ分析5 - 所得の変化幅をt.test()関数でt検定する。

Photo by Lesly Juarez on Unsplash www.crosshyou.info このブログは、上のブログの続きです。 今回は所得の変化幅をもう少し詳しくみてみます。 まずは、big6との関係を見てみます。 2016年から2017年の所得の変化幅は、big6は1万2千円、そうでないところ…

都道府県別の後期高齢者医療制度被保険者実態調査のデータ分析4 - 各変数の変化幅を計算してグラフにする。

Photo by Karsten Winegeart on Unsplash www.crosshyou.info の続きです。 今回は前回作成したワイド型のデータフレームを使って、各データの変化幅を計算していましょう。 mutate()関数を使います。 select()関数とsummary()関数を使って各変化幅のサマリ…

都道府県別の後期高齢者医療制度被保険者実態調査のデータ分析3 - R言語でロング型のデータフレームをワイド型に変換する。

Photo by Sharon Pittaway on Unsplash www.crosshyou.info このブログは上のブログの続きです。 今回はR言語のでロング型のデータフレームをワイド型に変換しようと思います。 ロング型のデータフレームは、 このように「科目」の列と「点数」で一つのデー…

都道府県別の後期高齢者医療制度被保険者実態調査のデータ分析2 - R言語でヒストグラム、箱ひげ図、散布図を描く。

Photo by JUNHØ on Unsplash www.crosshyou.info このブログは上のブログの続きです。 今回はデータをグラフにして視覚化しましょう。 まずは、ヒストグラムです。geom_histogram()関数を使います。 shotokuからいきます。 右端に離れ小島のように高額所得の…

都道府県別の後期高齢者医療制度被保険者実態調査のデータの分析1 - R言語にデータを読み込む。

Photo by Manuel Sardo on Unsplash 今回は都道府県別の後期高齢者医療制度被保険者実態調査のデータを分析してみようと思います。データは、政府統計の総合窓口(www.e-stat.go.jp)から取得しました。 この中から、都道府県別1人当たり所得額・保険料調定額…

OECD International Student Mobility Data Analysis 5 - Making a slope chart using R plot(), lines(), points() and text() functions.

Photo by Aditi Jain on Unsplash www.crosshyou.info This post is following of above post.In this post, I will make a slope chart using R.We can get an idea of changes based on the slope of the lines, so we can see which country has improved…

OECD International Student Mobility Data Analysis 4 - Which country has the largest net change for International Student Mobility?

Photo by Kumiko SHIMIZU on Unsplash www.crosshyou.info This post is following of above post. Let's make data frame which contains 2005 data only. Then, let's make data frame which contains 2018 data only. Then, join these two data frames w…

OECD International Student Mobility Data Analysis 3 - t-test with t.test() function using R

Photo by Tegar Surya on Unsplash www.crosshyou.info This post is following of above post.In this post, let's do t-test with t.test() function using R. In the previous post we see International Mobility is gradually increasing.Let's confirm…

OECD International Student Mobility Data Analysis 2 - making graphs with ggplot2() function.

Photo by Lance Anderson on Unsplash www.crosshyou.info This post is following of above post. In this post, let's make some graphs to see data distributions. First, let's see overall student_mobility data histogram. We see there are a few o…

OECD International Student Mobility Data Analysis 1 - load CSV file data into R with read_csv() function

Photo by Kenrick Baksh on Unsplash In this post I will analyze OECD International Student Mobility data using R. You can download data from Students - International student mobility - OECD Data CSV file image is below. Let's upload this da…

都道府県別のバスのデータの分析6 - バス会社の数を人口や県内総生産額などで回帰分析する

Photo by MusicFox Fx on Unsplash www.crosshyou.info 前回は差分でバス会社の数と人口や県内総生産額の回帰分析をしました。人口が10万増加すると、バス会社が8社増えるという関係でした。なんかそんなに増えるのか!という感じがします。 今回はもともと…

都道府県別のバスのデータの分析5 - 2001年のデータと2013年のデータの差分を回帰分析する。Breush-Pegan検定も実行。

Photo by david Griffiths on Unsplash www.crosshyou.info の続きです。 今回は前回作成した、2001年と2013年の差分のデータで回帰分析をしてみようと思います。 まず。各変数の散布図をみてみます。 firm_pop_diffとfirm_gdp_diffは非常に相関が強いですね…

都道府県別のバスのデータの分析4 - 2001年のデータと2013年のデータを比較する。

Photo by Brady Stoeltzing on Unsplash www.crosshyou.info の続きです。 前回の分析で、山梨県や島根県が人口や経済規模のわりにバス会社の数が多いことがわかりました。 今回は最新年の2013年と一番古い年の2001年でどれだけ各データが変化したのか見てみ…