• 検索結果がありません。

Read and Examine Data

N/A
N/A
Protected

Academic year: 2018

シェア "Read and Examine Data"

Copied!
35
0
0

読み込み中.... (全文を見る)

全文

(1)

Stata for us

ミクロデー 分析演習

Read and Examine Data 第1回

岡島 成治

(2)

こ 授業 ゴール

• Stataを自在 使いこ

1. Reading and Examining Data 2. Creating Variables

3. Organizing Data 4. Graphs

5. Programming

6. Creating a Tables

(3)

授業 評価

• 出席 100%

• 毎週 宿題 50%

友達やTA Shige 相談可 使え 何 利用 こ

(4)

Stata

• Stata 統計分析ソ 回帰分析 を手軽 こ うこ

出来

• 学生 約3万円 買うこ 出来

• 以下 ウ ッ ー を参考

http://www.lightstone.co.jp/stata/index.html

(5)

Stata 画面

Commandウィンドウ Results ウィンドウ

Variablesウィンドウ Reviewウィンドウ

(6)

Stata 画面

• Results ウィンドウ 分析 結果 表示さ

• Command ウィンドウ

コ ン いう命令文を打 こ Stataを動

• Review ウィンドウ

使用 コ ン 履歴 表示さ

• Variables ウィンドウ

Stata 読 込 ー セッ 変数 情報 表示さ

(7)

Stata 基本操作

• Stataを動 コ ン 呼 命令文を使用

コ ン 変数 変数

例)あ 変数height weightを表示 list height weight

例)あ 変数(height) 基本的 統計量を求 summary height

(8)

Do ファイル

• Stata コ ン Commandウ ン ウ 直接入力 実行

こ コ ン 微調整や再分析 出来 く

利点

Stataを終了 再現 Do

を用い こ

(9)

Do ファイル

Do 開 方

Window Do-file Editor New Do-file Editor

(10)

Do ファイル

• Do ァ 保存

ここを ッ 名前を付け 保存 い (DeskTop

BasicStat 保存)

(11)

Do ファイル

• コ ン 行 ///を使う

twoway (scatter var1 var2 if dummy==0) /// (scatter var1 var2 if dummy==1) ///

legend(label(1 failure) label(2 success))

• コ ン コ ン を書く **を使う

*基本統計量*

summary height

(12)

Do ファイル

• 複数行 わ コ ン を書く /* */ 囲 /*ここ コ ン

ここ コ ン 終わ */

• Do ァ 先頭 内容を書 込 習慣を!

(13)

作業フォル 指定

• Stataを使用 い 新 作成 ー セッ や図

を保存 必要 生 そ う 作業 を

明示的 指定 け べ 出力 ァ 指定

保存さ 便利 あ 使用 ー

セッ やdo ァ 入力 ァ 同 ァ

入 け コ ン を入力 必要 く

(14)

作業フォル 指定

Desktop こ 授業 新 い (BasicStat)を作 ツールバーでやる方法

1.

2. 作業 変更

3. 参照( ァ を選ぶ,BasicStat 4. OK

(15)

Excel ファイルをStataに読 込 せる

• 自分 Excel ァ (Canada)をBasicStat 入 ツールバーでやる方法

1.

2. ン ー

3. Excel ー 形式

4. 参照(Canada)を選択

(16)

Excel ファイルをStataに読 込 せる

• ー Stata ン ー さ を確認

ここを

(17)

デー をstata形式 保存

stataコ ン

save 名前を自分 決 ,replace 例

save G7lessGermanypwt90-2000,replace

を通 ー 名前(G7lessGermanypwt90-2000)を決

(18)

Examining the Data

(19)

Examining the data

• List(l)

• Assert

• Describe(d)

• Codebook

• Summarize (sum)

• Tabulate (tab)

• inspect

(20)

List(l)

listコ ン を用い result window ー セッ 表示さ

大 ー セッ 場合 あ 場所を確認 い場合

便利 例

list country year POP list country* year POP

* country いう語句 始 変数 べ を取 込

(21)

List(l)

list in 45/49

観測値 45番目 49番目を取 出 list in 50/l

観測値 50番目 最後 を取 出

list in -10/l

観測値 最後 個取 出

list if year==1997

1997年度 観測値を取 出 l

(22)

Assert

• 大 ー セッ 場合全 変数をList 確認 不

可能

• Statement 正 い う を確

• 例え POP 人口 あ え い ー セッ 中

あ う を確認 い

assert POP>0 assert POP<0

(23)

Describe(d)

ー セッ 関 基本的 情報を提供

describe

byte:整数 -127 127 ー変数 Int:整数 -32767 32767 例 年

long:整数 -2147483647 2147483647 例 人口 float:実数 8桁 例 生産量 ー

double:実数 16桁 String:文字列

(24)

Missing values

• 欠損値

数字 場合 . 表示さ

文字列 場合 空白 表示さ

(25)

Summarize (sum)

平均値 標準偏差等 統計量を表示 例

summarize

summarize,detail

Detailを加え 別 統計量(percentail等)を表示

(26)

Tabulate (tab)

• 度数分布表を作 時 table country

• あ ー 基礎統計量 平均 標準偏差 をtab sum

両方を 表示

tab year, sum(POP)

(27)

Inspect

• 外 値を確認 を作

inspect cgdp

(28)

Preserve restore

preserve ー を一時保存 resotore 元 状態

(29)

Keeping track of things

(30)

Do files

• Do files コ ン を打 込 そ Dofilesを保存 い 再現可能

(31)

Log files

• 今日 授業 結果 ロ 記録)を capture log close

log using StataForUs1, replace text set more off

今日 コ ン log close

(32)

Log files

capture log close

今 ロ ァ を閉

log using StataForUs1, replace text

ロ を開け Text ァ 通 い 場所

StataForUs1 保存さ set more off

休止 そ Stataを作動さ log close

ロ を閉

(33)

Labels

• label data "Data from Penn World Tables 6.1"

ー セッ 名前を け

• describe

ー セッ 現 確認

• label variable cgdp "GDP per capita in constant international dollaおかっ

変数 名前 説明を付け

(34)

Labels

• tabulate code

ー セッ 国名 数字 場合

• label define countrycode 1 "Canada" 2 "Germany" 3 "France"

数字 国 を示

• label values code countrycode code countycode を け

(35)

Labels

• describe 確認

• tabulate code 国 置 換わ

• codebook code 確認

• label list countrycode 確認

参照

関連したドキュメント

Log abelian varieties are defined as certain sheaves in the classical ´etale topol- ogy in [KKN08a], however the log flat topology is needed for studying some problems, for example

The case where S is the spectrum of an algebraically closed field is essential for the general local struc- ture theorem.. This case was proved in the previous paper [6], which was

strongly regular) if the orbits of G in X are separable, the partial intersections of the irreducible components of D are precisely the closures of the G-orbits in X and, for each

The goal of this paper is to reconstruct group-theoretically the inertia groups asso- ciated to various types of log divisors of a log configuration space of a smooth log curve from

QRコード読込画面 が表示されたら、表 示された画面を選択 してウインドウをアク ティブな状態にした 上で、QRコードリー

収益認識会計基準等を適用したため、前連結会計年度の連結貸借対照表において、「流動資産」に表示してい

工場設備の計測装置(燃料ガス発熱量計)と表示装置(新たに設置した燃料ガス 発熱量計)における燃料ガス発熱量を比較した結果を図 4-2-1-5 に示す。図

これらの実証試験等の結果を踏まえて改良を重ね、安全性評価の結果も考慮し、図 4.13 に示すプロ トタイプ タイプ B