Stata 11 whitepaper mwp 4 mwp mwp-028 / 41 mwp mwp mwp-079 functions 72 mwp-076 insheet 89 mwp-030 recode 94 mwp-033 reshape wide

Size: px
Start display at page:

Download "Stata 11 whitepaper mwp 4 mwp mwp-028 / 41 mwp mwp mwp-079 functions 72 mwp-076 insheet 89 mwp-030 recode 94 mwp-033 reshape wide"

Transcription

1 PS001

2 Stata 11 whitepaper mwp 4 mwp mwp-028 / 41 mwp mwp mwp-079 functions 72 mwp-076 insheet 89 mwp-030 recode 94 mwp-033 reshape wide/long 100 mwp-036 ivregress 110 mwp-082 logistic/logit 127 mwp-039 logistic/logit 137 mwp-040 margins 151 mwp-029 mlogit 167 mwp-090 ologit 184 mwp-088 poisson 199 mwp-087 regress 217 mwp-037 regress 235 mwp-038 anova/oneway 247 mwp-042 sdtest χ 2 F 272 mwp-043 ttest t 279 mwp-041 table 286 mwp-070 tabstat 294 mwp-071 tabulate 299 mwp-072 tabulate 305 mwp-073

3 StataCorp c 2011 Math c 2011 StataCorp LP Math web: master@math-koubou.jp

4 mwp-076 functions - Stata generate [D] functions [D] egen (mwp-077 ) Running sum t 3.2 t / 7. c Copyright Math c Copyright StataCorp LP (used with permission) 4

5 1. Stata [D] functions Random-number functions 1.1 runiform() [0, 1) (observations) 10 x 1 repeatability seed. set obs 10 obs was 0, now 10. set seed 2. generate x1 = runiform() * 1. list * 2 x [a, a + b) a + b*runiform() [10, 20) x 2 *1 Data Create or change data Create new variable *2 Data Describe data List data 5

6 . generate x2 = *runiform(). list x2 x round() floor(). generate x3 = round(x2). list x2 x3 x2 x round() floor() runiform(). generate x4 = round( *runiform()). list x4 x

7 Stata [D] functions Mathematical functions 2.1 round() floor() ceil() int() 0 (1) x round(x) floor(x) ceil(x) int(x) x = x = int() floor() (2) x round(x) floor(x) ceil(x) int(x) x = x = int() ceil() 7

8 2.2 Running sum sum() running sum 1, 2,..., 10 x. clear. set obs 10. generate x = n * 3 x running sum. generate y1 = sum(x). list x y y 1 i j=1 x j (i = 1, 2,..., 10) egen total() 10 j=1 x j. egen y2 = total(x) * 4. list x y1 y *3 n [U] 13.4 System variables *4 Data Create or change data Create new variable (extended) 8

9 3. Stata [D] functions Probability distributions and density functions Student t 3.1 t Example fuel.dta t. use clear * wide mpg1 mpg2. list, separator(0) mpg1 mpg mpg1 = mpg2 t 5% *5 File Example Datasets Stata 11 manual datasets Base Reference Manual [R] ttest 9

10 . ttest mpg1 == mpg2 * 6. ttest mpg1 == mpg2 Paired t test Variable Obs Mean Std. Err. Std. Dev. [95% Conf. Interval] mpg mpg diff mean(diff) = mean(mpg1 mpg2) t = Ho: mean(diff) = 0 degrees of freedom = 11 Ha: mean(diff) < 0 Ha: mean(diff)!= 0 Ha: mean(diff) > 0 Pr(T < t) = Pr( T > t ) = Pr(T > t) = mpg1 mpg t p ttest [R] ttest (mwp-041 ) 3.2 t tden(n, t) t t n n 11. twoway (function tden(11, x), range(-4 4)), ytitle("") xtitle(t) > title(t(11) distribution) * 7 *6 Statistics Summaries, tables and tests Classical tests of hypotheses Mean-comparison test, paired data *7 Graphics Twoway graph (scatter, line, etc.) 10

11 ttest t > Stata [D] functions Programming functions 4.1 / recode(), autocode(), irecode() age01.dta. use 11

12 . list, separator(0) age (1) recode() recode() (x, x 1, x 2,..., x n ) x 1, x 2,..., x n x. generate code1a = recode(age, 20, 30, 40, 50, 60, 70, 80, 90). list age code1a, separator(0) age code1a x 1, x 2,..., x n x > x n. generate code1b = recode(age, 25, 40, 60). list age code1b, separator(0) age code1b x > x n x n 12

13 (2) autocode() (3) irecode() 5. Stata [D] functions String functions 6. / Data Editor 10/15/ jan jan1960 daily() monthly() [D] functions Date and time functions mwp Stata [D] functions Matrix functions returning a matrix Matrix functions returning a scalar A = matrix input A = (1,1,1\1,2,2\1,2,3). matrix list A symmetric A[3,3] c1 c2 c3 r1 1 r2 1 2 r A A inv() 13

14 . matrix B = inv(a). matrix list B symmetric B[3,3] r1 r2 r3 c1 2 c2 1 2 c A 1 = A Cholesky cholesky(). matrix C = cholesky(a). matrix list C C[3,3] c1 c2 c3 r r r CC T. matrix D = C*C. matrix list D symmetric D[3,3] r1 r2 r3 r1 1 r2 1 2 r A = CC T 14

15 mwp-082 ivregress - OLS 1. OLS 2. OLS ivregress SLS 6.3 LIML 6.4 GMM 7. ivregress postestimation 7.1 estat endogenous 7.2 estat firststage 7.3 estat overid 1. OLS y i = β 0 + β 1 x i + u i, i = 1, 2,..., n (M1) β 0 β 1 2 (OLS: ordinary least squares) 4 c Copyright Math c Copyright StataCorp LP (used with permission) 15

16 x (fixed variable) u 0 E(u i ) = 0, i = 1, 2,..., n (M2) V (u i ) = E(u 2 i ) = σ 2, i = 1, 2,..., n (M3) Cov(u i, u j ) = E(u i u j ) = 0, i j, i, j = 1, 2,..., n (M4) OLS 2 (RSS: residual sum of squares) n n RSS = (y i ŷ i ) 2 = (y i ˆβ 0 ˆβ 1 x i ) 2 (M5) i=1 i=1 ˆβ 0, ˆβ 1 RSS ˆβ 0 RSS ˆβ 1 n = 2 (y i ˆβ 0 ˆβ 1 x i ) = 0 (M6a) i=1 n = 2 (y i ˆβ 0 ˆβ 1 x i )x i = 0 (M6b) i=1 ˆβ 0, ˆβ 1 n i=1 ˆβ 1 = (x n i x)(y i ȳ) i=1 n (= (x ) i x)y i=1 (x i i x) 2 n i=1 (x i x) 2 ˆβ 0 = ȳ ˆβ 1 x (M7a) (M7b) 2. OLS (1) (unbiasedness) θ ˆθ ˆθ E(ˆθ) θ E(ˆθ) = θ (M8) ˆθ (unbiased estimator) 1 4 OLS ˆβ 0, ˆβ 1 (BLUE: best linear unbiased estimator) [ Gauss-Markov ] 16

17 (2) (consistency) n ˆθ θ ϵ > 0 lim P ( ˆθ θ ϵ) = 0 n ˆθ θ (consistent estimator) ˆθ θ ˆθ θ OLS ˆβ 0, ˆβ 1 plim ˆθ = θ (M9) 3. 1 (1) x (M7a) y i ȳ = β 1 (x i x) + (u i ū) ˆβ 1 = n i=1 (x i x)(y i ȳ) n i=1 (x i x) 2 = β 1 + n i=1 (x i x)(u i ū) n i=1 (x i x) 2 (M10) [ n E[ ˆβ i=1 1 ] = β 1 + E (x ] i x)(u i ū) n i=1 (x i x) 2 (M11) 2 x u 0 x u 0 ˆβ 1 β 1 (2) [ n ] plim(v (x i )) = plim (x i x) 2 /n = σx 2 i=1 [ n ] plim(cov(x i, u i )) = plim (x i x)(u i ū)/n = σ xu i=1 17

18 (M10) [ n plim( ˆβ i=1 1 ) = plim β 1 + (x ] i x)(u i ū) n i=1 (x i x) 2 = β 1 + plim [ n i=1 (x ] i x)(u i ū)/n n i=1 (x i x) 2 /n = β 1 + plim [ n i=1 (x i x)(u i ū)/n] plim [ n i=1 (x i x) 2 /n] = β 1 + σ xu σ 2 x (M12) σ xu 0 x u ˆβ 1 β 1 (3) 2 ξ η η i = β 0 + β 1 ξ i + ϵ i, i = 1, 2,..., n η ξ x i y i y i = β 0 + β 1 x i + u i, i = 1, 2,..., n x i ξ i + v i v i u i = ϵ i β 1 v i Cov(x i, u i ) = Cov(ξ i + v i, ϵ i β 1 v i ) = β 1 σv 2 0 x u OLS (4) Y C I { Yi = C i + I i C i = β 0 + β 1 Y i + u i I (exogenous variable) Y i = β 0 1 β β 1 I i β 1 u i C i = β 0 1 β 1 + β 1 1 β 1 I i β 1 u i Y 18

19 Y u [ ] u 2 Cov(Y i, u i ) = E i = σ2 0 1 β 1 1 β 1 (endogenous variable) OLS ivregress 7. ivregress postestimation 19

20 mwp-037 regress - regress regress. regress mpg weight foreign Source SS df MS Number of obs = 74 F( 2, 71) = Model Prob > F = Residual R squared = Adj R squared = Total Root MSE = mpg Coef. Std. Err. t P> t [95% Conf. Interval] weight foreign _cons c Copyright Math c Copyright StataCorp LP (used with permission) 20

21 Stata Example auto.dta mpg = β 0 + β 1 weight + β 2 foreign + ϵ Stata regress 1.1 regress1.dta 1,000 use 5. list in 1/5 * 1 y x1 x2 x y. generate y = 0.5*x1 + 2*x rnormal(0, 10) x 1 x 2 rnormal(m, s) m s [D] functions y = 0.5x x 2 10 (1) x 1, x 2 x 3 y x 3 *1 Data Describe data List data 21

22 1.2 1,000 regress Statistics Linear models and related Linear regression Model : Dependent variable: y Independent variables: x1 x2 x3 1 regress - Model. regress y x1 x2 x3 Source SS df MS Number of obs = 1000 F( 3, 996) = Model Prob > F = Residual R squared = Adj R squared = Total Root MSE = y Coef. Std. Err. t P> t [95% Conf. Interval] x x x _cons (1) regress n(n 3) 2 rvfplot 22

23 . rvfplot, yline(0) * 2 (x 1i, x 2i,...) ŷ i y i y i ŷ i rvfplot (residual-versus-fitted plot) ŷ i 10 (2) R 2 regress regress ANOVA y SS (sum of squares) y i (i = 1,..., n) ȳ 2 y i ŷ i y (yi ȳ) 2 = (y i ŷ i ) 2 + (ŷ i ȳ) 2 (2) (yi ȳ) 2 TSS (total sum of squares) (ŷi ȳ) 2 MSS (model sum of squares) (yi ŷ i ) 2 RSS (residual sum of squares) TSS MSS RSS *2 Statistics Linear models and related Regression diagnostics Residual-versus-fitted plot 23

24 (coefficient of determination) R 2 = MSS TSS = 1 RSS TSS (3) / = ANOVA R-squared 39% (3) p R-squared 1 p Prob > F (ANOVA: analysis of variance) F H 0 H 0 : β 1 = β 2 = = 0 β 0 (4) ANOVA Coef. (coefficients) β 1 = 0.48 β2 = 1.97 β3 = 0.01 β0 = 8.91 (1) (5) p p β j = 0 t p x 3 p β 3 = 0 β 3 95% CI: confidence interval [ 0.21, 0.22] 0 x 3 x 1, x 2 p 0 regress p x postestimation 1 test Statistics Postestimation Tests Test linear hypotheses Main : Test type for specification 1: Linear expressions are equal Specification 1, linear expression: x1 =

25 2 test - Main. test (x1 = 0.5) ( 1) x1 =.5 F( 1, 996) = 0.62 Prob > F = (6) Coef. (standard error) Std. Err. (standard deviation) x 1 95% CI (degrees of freedom) 996 t invttail(n, p) [D] functions. display invttail(996, 0.025) * % (critical value). display * display * x 1 95% CI [ , ] *3 Data Other utilities Hand calculator 25

26 x 1, x ,000 1/10 resampling seed seed. set seed 111 * sample 100, count * 5 (900 observations deleted) 100 regress. regress y x1 x2 x3. regress y x1 x2 x3 Source SS df MS Number of obs = 100 F( 3, 96) = Model Prob > F = Residual R squared = Adj R squared = Total Root MSE = y Coef. Std. Err. t P> t [95% Conf. Interval] x x x _cons R 2 x x % test *4 [R] set seed *5 Statistics Resampling Draw random sample 26

27 . test (x1 = 0.37). test (x1 = 0.37) ( 1) x1 =.37 F( 1, 96) = 3.65 Prob > F = test (x1 = 0.8). test (x1 = 0.8) ( 1) x1 =.8 F( 1, 96) = 3.74 Prob > F = p 0.05 (significance level) 5% Reporting Confidence level 3 2. Stata Example auto.dta. sysuse auto.dta * 6 (1978 Automobile Data) mpg (miles per gallon) weight 2 weight 2 2 c.weight#c.weight mwp-028. generate weightsq = weight^2 * 7 *6 File Example datasets Example datasets installed with Stata *7 Data Create or change data Create new variable 27

28 . format weightsq %10.0g * 8. list mpg weight weightsq in 1/5 * 9 mpg weight weightsq , , , , , weight K 2 2. regress mpg weight weightsq * 10. regress mpg weight weightsq Source SS df MS Number of obs = 74 F( 2, 71) = Model Prob > F = Residual R squared = Adj R squared = Total Root MSE = mpg Coef. Std. Err. t P> t [95% Conf. Interval] weight weightsq 1.32e e e e 06 _cons mpg = 1.42e-2 weight e-6 weight mpg weight weight weight (normalize) 0 1 beta *8 Variables weightsq Format weightsq *9 Data Describe data List data *10 Statistics Linear models and related Linear regression 28

29 regress : Reporting : Standardized beta coefficients: 3 regress - Reporting. regress mpg weight weightsq, beta Source SS df MS Number of obs = 74 F( 2, 71) = Model Prob > F = Residual R squared = Adj R squared = Total Root MSE = mpg Coef. Std. Err. t P> t Beta weight weightsq 1.32e e _cons beta weight weight

30 3. auto.dta weight length β 0 length = 0 β 0 β 0 = 0 noconstant Statistics Linear models and related Linear regression Model : Dependent variable: weight Independent variables: length Suppress constant term:. regress weight length, noconstant Source SS df MS Number of obs = 74 F( 1, 73) = Model Prob > F = Residual R squared = Adj R squared = Total Root MSE = weight Coef. Std. Err. t P> t [95% Conf. Interval] length Example census9.dta. use clear * 11 (1980 Census data by state) *11 File Example Datasets Stata 11 manual datasets Base Reference Manual [R] regress 30

31 . list state drate pop medage region in 1/5, nolabel * 12 state drate pop medage region 1. Alabama 91 3,893, Alaska , Arizona 78 2,718, Arkansas 99 2,286, California 79 23,667, (drate) (medage) (region) region Northeast, North Central, South, West 1, 2, 3, 4 drate medage pop mwp regress - Weights Analytic weights Frequency weights Alabama 3, 893, *12 region 31

32 Statistics Linear models and related Linear regression Model : Dependent variable: drate Independent variables: medage i.region * 13 Weights : Analytic weights: pop. regress drate medage i.region [aweight = pop] (sum of wgt is e+08) Source SS df MS Number of obs = 50 F( 4, 45) = Model Prob > F = Residual R squared = Adj R squared = Total Root MSE = drate Coef. Std. Err. t P> t [95% Conf. Interval] medage region _cons [aweight = pop] 5. regress 2 (OLS: ordinary least squares) OLS (homoskedasticity) Example auto.dta. sysuse auto, clear (1978 Automobile Data). replace weight = weight/1000 * 14 *13 i. mwp-028 *14 Data Create or change data Change contents of variable K 32

33 . regress mpg weight. regress mpg weight Source SS df MS Number of obs = 74 F( 1, 72) = Model Prob > F = Residual R squared = Adj R squared = Total Root MSE = mpg Coef. Std. Err. t P> t [95% Conf. Interval] weight _cons twoway (scatter mpg weight) (lfit mpg weight), ytitle(mpg) * 15 1 rvpplot (residual-versus-predictor plot). rvpplot weight, yline(0) * 16 *15 Graphics Twoway graph (scatter, line, etc.) *16 Statistics Linear models and related Regression diagnostics Residual-versus-predictor plot 33

34 rvpplot weight (heteroskedasticity) Statistics Postestimation Reports and statistics estat : Reports and statistics: Tests for heteroskedasticity (hettest) 5 estat 34

35 . estat hettest Breusch Pagan / Cook Weisberg test for heteroskedasticity Ho: Constant variance Variables: fitted values of mpg chi2(1) = Prob > chi2 = estat hettest H 0 p H 0 OLS OLS regress SE/Robust SE (standard error) Statistics Linear models and related Linear regression Model : Dependent variable: mpg Independent variables: weight SE/Robust : Robust 6 regress - SE/Robust 35

36 . regress mpg weight, vce(robust) Linear regression Number of obs = 74 F( 1, 72) = Prob > F = R squared = Root MSE = Robust mpg Coef. Std. Err. t P> t [95% Conf. Interval] weight _cons vce(robust) OLS 95% CI OLS Robust weight [ 7.04, 4.98] [ 7.17, 4.84] cons [36.22, 42.66] [35.48, 43.40] SE/Robust Clustered robust 36

37 5 Graphics Twoway graph (scatter, line, etc.) Plots Create Plot 1 Choose a plot category and type: Basic plots Basic plots: Scatter Y variable: mpg X variable: weight Plots Create Plot 2 Choose a plot category and type: Fit plots Fit plots: Linear prediction Y variable: mpg X variable: weight Y axis : Title: mpg. twoway (scatter mpg weight) (lfit mpg weight), ytitle(mpg) 37

38 mwp-042 anova/oneway - anova oneway ANOVA ANOVA oneway 4. ANOVA anova ANOVA 7. ANOVA 8. ANOVA 1. 2 t mwp A, B, C t α 5% (1) A-B = 0.95 (2) A-C = 0.95 (3) B-C = = 0.86 (1), (2), (3) = % c Copyright Math c Copyright StataCorp LP (used with permission) 38

39 3 (ANOVA: analysis of variance) F (multiple comparison) 2. (1) (2) (3) (4) (repeated-measures) ANOVA 3. ANOVA oneway (factor) 1 ANOVA (one-way ANOVA) ANOVA anova, oneway oneway anova1.dta. use clear 24 (blood pressure). list if n <= 3 n >= 22, separator(3) * 1 bp drug drug 1, 2, 3, 4 4 drug *2 *1 Data Describe data List data *2 Stata 39

40 drug bp oneway α 5% Statistics Linear models and related ANOVA/MANOVA One-way ANOVA Main : Response variable: bp Factor variable: drug Multiple-comparison tests: Bonferroni Output: Produce summary table: 1 oneway - Main 40

41 . oneway bp drug, bonferroni tabulate Summary of bp drug Mean Std. Dev. Freq Total Analysis of Variance Source SS df MS F Prob > F Between groups Within groups Total Bartlett's test for equal variances: chi2(3) = Prob>chi2 = Comparison of bp by drug (Bonferroni) Row Mean Col Mean (1) ANOVA tabulate (frequency) 6 oneway anova (unbalanced data) ANOVA Analysis of Variance Source SS df MS F Prob > F Between groups Within groups Total Bartlett's test for equal variances: chi2(3) = Prob>chi2 =

42 SS (sum of squares) regress mwp-037 y (yi ȳ) 2 = (y i ŷ i ) 2 + (ŷ i ȳ) 2 (yi ȳ) 2 TSS (total sum of squares) (ŷi ȳ) 2 MSS (model sum of squares) (yi ŷ i ) 2 RSS (residual sum of squares) MSS (between groups) RSS (within groups) TSS (total) (df: degrees of freedom) MS (mean square) , F /54.16 = 3.92 F F p p < 0.05 ANOVA Bartlett ANOVA p 0.05 (2) ANOVA µ 1 = µ 2 = µ 3 = µ 4 bonferroni Bonferroni ANOVA Comparison of bp by drug (Bonferroni) Row Mean Col Mean M ij M ij µ i µ j 0 Bonferroni p µ 4 µ 2 Bonferroni Scheffe, Šidák 42

43 4. ANOVA anova ANOVA 7. ANOVA 8. ANOVA ANOVA 43

44 mwp-070 table - table Superrows, supercolumns 1. table table table n n (n-way table) n 7 (frequency) (mean) (standard deviation) (maximum) (minimum) (median) (interquantile range) (percentile) c Copyright Math c Copyright StataCorp LP (used with permission) 44

45 2. Example auto.dta. sysuse auto.dta * 1 (1978 Automobile Data) displacement. generate disp1 = 16.4*displacement/1000 * 2 disp1. summarize disp1 * 3. summarize disp1 Variable Obs Mean Std. Dev. Min Max disp l 7.0l disp1 class class 0 disp < disp < disp < disp1. generate class = irecode(disp1, 2.0, 3.0, 4.0) * 4 5 disp1 class. list make disp1 class in 1/5 make disp1 class 1. AMC Concord AMC Pacer AMC Spirit Buick Century Buick Electra *1 File Example datasets Example datasets installed with Stata *2 Data Create or change data Create new variable *3 Statistics Summaries, tables and tests Summary and descriptive statistics Summary statistics *4 irecode() [D] functions 45

46 class mpg (miles per gallon) Statistics Summaries, tables, and tests Tables Table of summary statistics (table) Main : Row variable: class Statistics 1: Count nonmissing mpg Statistics 2: Mean mpg Statistics 3: Standard deviation mpg 1 table - Main. table class, contents(count mpg mean mpg sd mpg ) class N(mpg) mean(mpg) sd(mpg) mpg class *5 *5 Variables Manager 46

47 . label define class 0 "<2000cc" 1 " cc" 2 " cc" 3 ">4000cc". label values class class. table class, contents(count mpg mean mpg sd mpg ). table class, contents(count mpg mean mpg sd mpg ) class N(mpg) mean(mpg) sd(mpg) <2000cc cc cc >4000cc table Options Options : Override display format for numbers in cells: %9.2f 2 table - Options. table class, contents(count mpg mean mpg sd mpg ) format(%9.2f) class N(mpg) mean(mpg) sd(mpg) <2000cc cc cc >4000cc

48

Stata11 whitepapers mwp-037 regress - regress regress. regress mpg weight foreign Source SS df MS Number of obs = 74 F(

Stata11 whitepapers mwp-037 regress - regress regress. regress mpg weight foreign Source SS df MS Number of obs = 74 F( mwp-037 regress - regress 1. 1.1 1.2 1.3 2. 3. 4. 5. 1. regress. regress mpg weight foreign Source SS df MS Number of obs = 74 F( 2, 71) = 69.75 Model 1619.2877 2 809.643849 Prob > F = 0.0000 Residual

More information

BR001

BR001 BR001 Stata 11 Stata Stata11 whitepaper mwp 3 mwp-027 22 mwp-028 / 40 mwp-001 logistic/logit 50 mwp-039 logistic/logit postestimation 60 mwp-040 margins 74 mwp-029 regress 90 mwp-037 regress postestimation

More information

Stata 11 Stata ROC whitepaper mwp anova/oneway 3 mwp-042 kwallis Kruskal Wallis 28 mwp-045 ranksum/median / 31 mwp-047 roctab/roccomp ROC 34 mwp-050 s

Stata 11 Stata ROC whitepaper mwp anova/oneway 3 mwp-042 kwallis Kruskal Wallis 28 mwp-045 ranksum/median / 31 mwp-047 roctab/roccomp ROC 34 mwp-050 s BR003 Stata 11 Stata ROC whitepaper mwp anova/oneway 3 mwp-042 kwallis Kruskal Wallis 28 mwp-045 ranksum/median / 31 mwp-047 roctab/roccomp ROC 34 mwp-050 sampsi 47 mwp-044 sdtest 54 mwp-043 signrank/signtest

More information

こんにちは由美子です

こんにちは由美子です Analysis of Variance 2 two sample t test analysis of variance (ANOVA) CO 3 3 1 EFV1 µ 1 µ 2 µ 3 H 0 H 0 : µ 1 = µ 2 = µ 3 H A : Group 1 Group 2.. Group k population mean µ 1 µ µ κ SD σ 1 σ σ κ sample mean

More information

Stata 11 Stata ts (ARMA) ARCH/GARCH whitepaper mwp 3 mwp-083 arch ARCH 11 mwp-051 arch postestimation 27 mwp-056 arima ARMA 35 mwp-003 arima postestim

Stata 11 Stata ts (ARMA) ARCH/GARCH whitepaper mwp 3 mwp-083 arch ARCH 11 mwp-051 arch postestimation 27 mwp-056 arima ARMA 35 mwp-003 arima postestim TS001 Stata 11 Stata ts (ARMA) ARCH/GARCH whitepaper mwp 3 mwp-083 arch ARCH 11 mwp-051 arch postestimation 27 mwp-056 arima ARMA 35 mwp-003 arima postestimation 49 mwp-055 corrgram/ac/pac 56 mwp-009 dfgls

More information

最小2乗法

最小2乗法 2 2012 4 ( ) 2 2012 4 1 / 42 X Y Y = f (X ; Z) linear regression model X Y slope X 1 Y (X, Y ) 1 (X, Y ) ( ) 2 2012 4 2 / 42 1 β = β = β (4.2) = β 0 + β (4.3) ( ) 2 2012 4 3 / 42 = β 0 + β + (4.4) ( )

More information

ECCS. ECCS,. ( 2. Mac Do-file Editor. Mac Do-file Editor Windows Do-file Editor Top Do-file e

ECCS. ECCS,. (  2. Mac Do-file Editor. Mac Do-file Editor Windows Do-file Editor Top Do-file e 1 1 2015 4 6 1. ECCS. ECCS,. (https://ras.ecc.u-tokyo.ac.jp/guacamole/) 2. Mac Do-file Editor. Mac Do-file Editor Windows Do-file Editor Top Do-file editor, Do View Do-file Editor Execute(do). 3. Mac System

More information

第11回:線形回帰モデルのOLS推定

第11回:線形回帰モデルのOLS推定 11 OLS 2018 7 13 1 / 45 1. 2. 3. 2 / 45 n 2 ((y 1, x 1 ), (y 2, x 2 ),, (y n, x n )) linear regression model y i = β 0 + β 1 x i + u i, E(u i x i ) = 0, E(u i u j x i ) = 0 (i j), V(u i x i ) = σ 2, i

More information

% 10%, 35%( 1029 ) p (a) 1 p 95% (b) 1 Std. Err. (c) p 40% 5% (d) p 1: STATA (1). prtesti One-sample test of pr

% 10%, 35%( 1029 ) p (a) 1 p 95% (b) 1 Std. Err. (c) p 40% 5% (d) p 1: STATA (1). prtesti One-sample test of pr 1 1. 2014 6 2014 6 10 10% 10%, 35%( 1029 ) p (a) 1 p 95% (b) 1 Std. Err. (c) p 40% 5% (d) p 1: STATA (1). prtesti 1029 0.35 0.40 One-sample test of proportion x: Number of obs = 1029 Variable Mean Std.

More information

卒業論文

卒業論文 Y = ax 1 b1 X 2 b2...x k bk e u InY = Ina + b 1 InX 1 + b 2 InX 2 +...+ b k InX k + u X 1 Y b = ab 1 X 1 1 b 1 X 2 2...X bk k e u = b 1 (ax b1 1 X b2 2...X bk k e u ) / X 1 = b 1 Y / X 1 X 1 X 1 q YX1

More information

Stata 11 Stata VAR VEC whitepaper mwp 4 mwp-084 var VAR 14 mwp-004 varbasic VAR 25 mwp-005 svar VAR 31 mwp-007 vec intro VEC 47 mwp-008 vec VEC 75 mwp

Stata 11 Stata VAR VEC whitepaper mwp 4 mwp-084 var VAR 14 mwp-004 varbasic VAR 25 mwp-005 svar VAR 31 mwp-007 vec intro VEC 47 mwp-008 vec VEC 75 mwp TS002 Stata 11 Stata VAR VEC whitepaper mwp 4 mwp-084 var VAR 14 mwp-004 varbasic VAR 25 mwp-005 svar VAR 31 mwp-007 vec intro VEC 47 mwp-008 vec VEC 75 mwp-063 VAR postestimation vargranger Granger 86

More information

TS002

TS002 TS002 Stata 12 Stata VAR VEC whitepaper mwp 4 mwp-084 var VAR 14 mwp-004 varbasic VAR 26 mwp-005 svar VAR 33 mwp-007 vec intro VEC 51 mwp-008 vec VEC 80 mwp-063 VAR vargranger Granger 93 mwp-062 varlmar

More information

.. est table TwoSLS1 TwoSLS2 GMM het,b(%9.5f) se Variable TwoSLS1 TwoSLS2 GMM_het hi_empunion totchr

.. est table TwoSLS1 TwoSLS2 GMM het,b(%9.5f) se Variable TwoSLS1 TwoSLS2 GMM_het hi_empunion totchr 3,. Cameron and Trivedi (2010) Microeconometrics Using Stata, Revised Edition, Stata Press 6 Linear instrumentalvariables regression 9 Linear panel-data models: Extensions.. GMM xtabond., GMM(Generalized

More information

80 X 1, X 2,, X n ( λ ) λ P(X = x) = f (x; λ) = λx e λ, x = 0, 1, 2, x! l(λ) = n f (x i ; λ) = i=1 i=1 n λ x i e λ i=1 x i! = λ n i=1 x i e nλ n i=1 x

80 X 1, X 2,, X n ( λ ) λ P(X = x) = f (x; λ) = λx e λ, x = 0, 1, 2, x! l(λ) = n f (x i ; λ) = i=1 i=1 n λ x i e λ i=1 x i! = λ n i=1 x i e nλ n i=1 x 80 X 1, X 2,, X n ( λ ) λ P(X = x) = f (x; λ) = λx e λ, x = 0, 1, 2, x! l(λ) = n f (x i ; λ) = n λ x i e λ x i! = λ n x i e nλ n x i! n n log l(λ) = log(λ) x i nλ log( x i!) log l(λ) λ = 1 λ n x i n =

More information

第13回:交差項を含む回帰・弾力性の推定

第13回:交差項を含む回帰・弾力性の推定 13 2018 7 27 1 / 31 1. 2. 2 / 31 y i = β 0 + β X x i + β Z z i + β XZ x i z i + u i, E(u i x i, z i ) = 0, E(u i u j x i, z i ) = 0 (i j), V(u i x i, z i ) = σ 2, i = 1, 2,, n x i z i 1 3 / 31 y i = β

More information

1 Stata SEM LightStone 4 SEM 4.. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press 3.

1 Stata SEM LightStone 4 SEM 4.. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press 3. 1 Stata SEM LightStone 4 SEM 4.. Alan C. Acock, 2013. Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press 3. 2 4, 2. 1 2 2 Depress Conservative. 3., 3,. SES66 Alien67 Alien71,

More information

k2 ( :35 ) ( k2) (GLM) web web 1 :

k2 ( :35 ) ( k2) (GLM) web   web   1 : 2012 11 01 k2 (2012-10-26 16:35 ) 1 6 2 (2012 11 01 k2) (GLM) kubo@ees.hokudai.ac.jp web http://goo.gl/wijx2 web http://goo.gl/ufq2 1 : 2 2 4 3 7 4 9 5 : 11 5.1................... 13 6 14 6.1......................

More information

AR(1) y t = φy t 1 + ɛ t, ɛ t N(0, σ 2 ) 1. Mean of y t given y t 1, y t 2, E(y t y t 1, y t 2, ) = φy t 1 2. Variance of y t given y t 1, y t

AR(1) y t = φy t 1 + ɛ t, ɛ t N(0, σ 2 ) 1. Mean of y t given y t 1, y t 2, E(y t y t 1, y t 2, ) = φy t 1 2. Variance of y t given y t 1, y t 87 6.1 AR(1) y t = φy t 1 + ɛ t, ɛ t N(0, σ 2 ) 1. Mean of y t given y t 1, y t 2, E(y t y t 1, y t 2, ) = φy t 1 2. Variance of y t given y t 1, y t 2, V(y t y t 1, y t 2, ) = σ 2 3. Thus, y t y t 1,

More information

こんにちは由美子です

こんにちは由美子です 1 2 . sum Variable Obs Mean Std. Dev. Min Max ---------+----------------------------------------------------- var1 13.4923077.3545926.05 1.1 3 3 3 0.71 3 x 3 C 3 = 0.3579 2 1 0.71 2 x 0.29 x 3 C 2 = 0.4386

More information

28

28 y i = Z i δ i +ε i ε i δ X y i = X Z i δ i + X ε i [ ] 1 δ ˆ i = Z i X( X X) 1 X Z i [ ] 1 σ ˆ 2 Z i X( X X) 1 X Z i Z i X( X X) 1 X y i σ ˆ 2 ˆ σ 2 = [ ] y i Z ˆ [ i δ i ] 1 y N p i Z i δ ˆ i i RSTAT

More information

1 Stata SEM LightStone 3 2 SEM. 2., 2,. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press.

1 Stata SEM LightStone 3 2 SEM. 2., 2,. Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press. 1 Stata SEM LightStone 3 2 SEM. 2., 2,. Alan C. Acock, 2013. Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press. 2 3 2 Conservative Depress. 3.1 2. SEM. 1. x SEM. Depress.

More information

4.9 Hausman Test Time Fixed Effects Model vs Time Random Effects Model Two-way Fixed Effects Model

4.9 Hausman Test Time Fixed Effects Model vs Time Random Effects Model Two-way Fixed Effects Model 1 EViews 5 2007 7 11 2010 5 17 1 ( ) 3 1.1........................................... 4 1.2................................... 9 2 11 3 14 3.1 Pooled OLS.............................................. 14

More information

Rによる計量分析:データ解析と可視化 - 第3回 Rの基礎とデータ操作・管理

Rによる計量分析:データ解析と可視化 - 第3回  Rの基礎とデータ操作・管理 R 3 R 2017 Email: gito@eco.u-toyama.ac.jp October 23, 2017 (Toyama/NIHU) R ( 3 ) October 23, 2017 1 / 34 Agenda 1 2 3 4 R 5 RStudio (Toyama/NIHU) R ( 3 ) October 23, 2017 2 / 34 10/30 (Mon.) 12/11 (Mon.)

More information

Microsoft Word - 計量研修テキスト_第5版).doc

Microsoft Word - 計量研修テキスト_第5版).doc Q10-2 テキスト P191 1. 記述統計量 ( 変数 :YY95) 表示変数として 平均 中央値 最大値 最小値 標準偏差 観測値 を選択 A. 都道府県別 Descriptive Statistics for YY95 Categorized by values of PREFNUM Date: 05/11/06 Time: 14:36 Sample: 1990 2002 Included

More information

kubostat2017c p (c) Poisson regression, a generalized linear model (GLM) : :

kubostat2017c p (c) Poisson regression, a generalized linear model (GLM) : : kubostat2017c p.1 2017 (c), a generalized linear model (GLM) : kubo@ees.hokudai.ac.jp http://goo.gl/76c4i 2017 11 14 : 2017 11 07 15:43 kubostat2017c (http://goo.gl/76c4i) 2017 (c) 2017 11 14 1 / 47 agenda

More information

(lm) lm AIC 2 / 1

(lm) lm AIC 2 / 1 W707 s-taiji@is.titech.ac.jp 1 / 1 (lm) lm AIC 2 / 1 : y = β 1 x 1 + β 2 x 2 + + β d x d + β d+1 + ϵ (ϵ N(0, σ 2 )) y R: x R d : β i (i = 1,..., d):, β d+1 : ( ) (d = 1) y = β 1 x 1 + β 2 + ϵ (d > 1) y

More information

1 Stata SEM LightStone 1 5 SEM Stata Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press. Introduc

1 Stata SEM LightStone 1 5 SEM Stata Alan C. Acock, Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press. Introduc 1 Stata SEM LightStone 1 5 SEM Stata Alan C. Acock, 2013. Discovering Structural Equation Modeling Using Stata, Revised Edition, Stata Press. Introduction to confirmatory factor analysis 9 Stata14 2 1

More information

yamadaiR(cEFA).pdf

yamadaiR(cEFA).pdf R 2012/10/05 Kosugi,E.Koji (Yamadai.R) Categorical Factor Analysis by using R 2012/10/05 1 / 9 Why we use... 3 5 Kosugi,E.Koji (Yamadai.R) Categorical Factor Analysis by using R 2012/10/05 2 / 9 FA vs

More information

こんにちは由美子です

こんにちは由美子です 1 2 λ 3 λ λ. correlate father mother first second (obs=20) father mother first second ---------+------------------------------------ father 1.0000 mother 0.2254 1.0000 first 0.7919 0.5841 1.0000 second

More information

kubostat2018d p.2 :? bod size x and fertilization f change seed number? : a statistical model for this example? i response variable seed number : { i

kubostat2018d p.2 :? bod size x and fertilization f change seed number? : a statistical model for this example? i response variable seed number : { i kubostat2018d p.1 I 2018 (d) model selection and kubo@ees.hokudai.ac.jp http://goo.gl/76c4i 2018 06 25 : 2018 06 21 17:45 1 2 3 4 :? AIC : deviance model selection misunderstanding kubostat2018d (http://goo.gl/76c4i)

More information

Stata User Group Meeting in Kyoto / ( / ) Stata User Group Meeting in Kyoto / 21

Stata User Group Meeting in Kyoto / ( / ) Stata User Group Meeting in Kyoto / 21 Stata User Group Meeting in Kyoto / 2017 9 16 ( / ) Stata User Group Meeting in Kyoto 2017 9 16 1 / 21 Rosenbaum and Rubin (1983) logit/probit, ATE = E [Y 1 Y 0 ] ( / ) Stata User Group Meeting in Kyoto

More information

4 OLS 4 OLS 4.1 nurseries dual c dual i = c + βnurseries i + ε i (1) 1. OLS Workfile Quick - Estimate Equation OK Equation specification dual c nurser

4 OLS 4 OLS 4.1 nurseries dual c dual i = c + βnurseries i + ε i (1) 1. OLS Workfile Quick - Estimate Equation OK Equation specification dual c nurser 1 EViews 2 2007/5/17 2007/5/21 4 OLS 2 4.1.............................................. 2 4.2................................................ 9 4.3.............................................. 11 4.4

More information

151021slide.dvi

151021slide.dvi : Mac I 1 ( 5 Windows (Mac Excel : Excel 2007 9 10 1 4 http://asakura.co.jp/ books/isbn/978-4-254-12172-8/ (1 1 9 1/29 (,,... (,,,... (,,, (3 3/29 (, (F7, Ctrl + i, (Shift +, Shift + Ctrl (, a i (, Enter,

More information

s = 1.15 (s = 1.07), R = 0.786, R = 0.679, DW =.03 5 Y = 0.3 (0.095) (.708) X, R = 0.786, R = 0.679, s = 1.07, DW =.03, t û Y = 0.3 (3.163) + 0

s = 1.15 (s = 1.07), R = 0.786, R = 0.679, DW =.03 5 Y = 0.3 (0.095) (.708) X, R = 0.786, R = 0.679, s = 1.07, DW =.03, t û Y = 0.3 (3.163) + 0 7 DW 7.1 DW u 1, u,, u (DW ) u u 1 = u 1, u,, u + + + - - - - + + - - - + + u 1, u,, u + - + - + - + - + u 1, u,, u u 1, u,, u u +1 = u 1, u,, u Y = α + βx + u, u = ρu 1 + ɛ, H 0 : ρ = 0, H 1 : ρ 0 ɛ 1,

More information

k3 ( :07 ) 2 (A) k = 1 (B) k = 7 y x x 1 (k2)?? x y (A) GLM (k

k3 ( :07 ) 2 (A) k = 1 (B) k = 7 y x x 1 (k2)?? x y (A) GLM (k 2012 11 01 k3 (2012-10-24 14:07 ) 1 6 3 (2012 11 01 k3) kubo@ees.hokudai.ac.jp web http://goo.gl/wijx2 web http://goo.gl/ufq2 1 3 2 : 4 3 AIC 6 4 7 5 8 6 : 9 7 11 8 12 8.1 (1)........ 13 8.2 (2) χ 2....................

More information

Stata13 Stata long/wide whitepaper mwp mcode import excel Excel / 4 mwp-092 import delimited 10 mwp-195 infix 17 mwp-031 infile 23 mwp-080 append 29 m

Stata13 Stata long/wide whitepaper mwp mcode import excel Excel / 4 mwp-092 import delimited 10 mwp-195 infix 17 mwp-031 infile 23 mwp-080 append 29 m BD001A Stata13 Stata long/wide whitepaper mwp mcode import excel Excel / 4 mwp-092 import delimited 10 mwp-195 infix 17 mwp-031 infile 23 mwp-080 append 29 mwp-034 merge 33 mwp-035 reshape wide/long 40

More information

: (EQS) /EQUATIONS V1 = 30*V F1 + E1; V2 = 25*V *F1 + E2; V3 = 16*V *F1 + E3; V4 = 10*V F2 + E4; V5 = 19*V99

: (EQS) /EQUATIONS V1 = 30*V F1 + E1; V2 = 25*V *F1 + E2; V3 = 16*V *F1 + E3; V4 = 10*V F2 + E4; V5 = 19*V99 218 6 219 6.11: (EQS) /EQUATIONS V1 = 30*V999 + 1F1 + E1; V2 = 25*V999 +.54*F1 + E2; V3 = 16*V999 + 1.46*F1 + E3; V4 = 10*V999 + 1F2 + E4; V5 = 19*V999 + 1.29*F2 + E5; V6 = 17*V999 + 2.22*F2 + E6; CALIS.

More information

1 y x y = α + x β+ε (1) x y (2) x y (1) (2) (1) y (2) x y (1) (2) y x y ε x 12 x y 3 3 β x β x 1 1 β 3 1

1 y x y = α + x β+ε (1) x y (2) x y (1) (2) (1) y (2) x y (1) (2) y x y ε x 12 x y 3 3 β x β x 1 1 β 3 1 1 y x y = α + x β+ε (1) x y (2) x y (1) (2) (1) y (2) x y (1) (2) y x y ε x 12 x y 3 3 β x β x 1 1 β 3 1 2 2 N y(n 1 ) x(n K ) y = E(y x) + u E(y x) y u(n 1 ) y = x β + u β Ordinary Least Squares:OLS (min

More information

untitled

untitled 2011/6/22 M2 1*1+2*2 79 2F Y YY 0.0 0.2 0.4 0.6 0.8 0.000 0.002 0.004 0.006 0.008 0.010 0.012 1.0 1.5 2.0 2.5 3.0 3.5 4.0 Y 0 50 100 150 200 250 YY A (Y = X + e A ) B (YY = X + e B ) X 0.00 0.05 0.10

More information

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó 2 2015 4 20 1 (4/13) : ruby 2 / 49 2 ( ) : gnuplot 3 / 49 1 1 2014 6 IIJ / 4 / 49 1 ( ) / 5 / 49 ( ) 6 / 49 (summary statistics) : (mean) (median) (mode) : (range) (variance) (standard deviation) 7 / 49

More information

講義のーと : データ解析のための統計モデリング. 第3回

講義のーと :  データ解析のための統計モデリング. 第3回 Title 講義のーと : データ解析のための統計モデリング Author(s) 久保, 拓弥 Issue Date 2008 Doc URL http://hdl.handle.net/2115/49477 Type learningobject Note この講義資料は, 著者のホームページ http://hosho.ees.hokudai.ac.jp/~kub ードできます Note(URL)http://hosho.ees.hokudai.ac.jp/~kubo/ce/EesLecture20

More information

<4D F736F F D20939D8C7689F090CD985F93C18EEA8D758B E646F63>

<4D F736F F D20939D8C7689F090CD985F93C18EEA8D758B E646F63> Gretl OLS omitted variable omitted variable AIC,BIC a) gretl gretl sample file Greene greene8_3 Add Define new variable l_g_percapita=log(g/pop) Pg,Y,Pnc,Puc,Ppt,Pd,Pn,Ps Add logs of selected variables

More information

一般化線形 (混合) モデル (2) - ロジスティック回帰と GLMM

一般化線形 (混合) モデル (2) - ロジスティック回帰と GLMM .. ( ) (2) GLMM kubo@ees.hokudai.ac.jp I http://goo.gl/rrhzey 2013 08 27 : 2013 08 27 08:29 kubostat2013ou2 (http://goo.gl/rrhzey) ( ) (2) 2013 08 27 1 / 74 I.1 N k.2 binomial distribution logit link function.3.4!

More information

1 15 R Part : website:

1 15 R Part : website: 1 15 R Part 4 2017 7 24 4 : website: email: http://www3.u-toyama.ac.jp/kkarato/ kkarato@eco.u-toyama.ac.jp 1 2 2 3 2.1............................... 3 2.2 2................................. 4 2.3................................

More information

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó

¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè2²ó 2 212 4 13 1 (4/6) : ruby 2 / 35 ( ) : gnuplot 3 / 35 ( ) 4 / 35 (summary statistics) : (mean) (median) (mode) : (range) (variance) (standard deviation) 5 / 35 (mean): x = 1 n (median): { xr+1 m, m = 2r

More information

y i OLS [0, 1] OLS x i = (1, x 1,i,, x k,i ) β = (β 0, β 1,, β k ) G ( x i β) 1 G i 1 π i π i P {y i = 1 x i } = G (

y i OLS [0, 1] OLS x i = (1, x 1,i,, x k,i ) β = (β 0, β 1,, β k ) G ( x i β) 1 G i 1 π i π i P {y i = 1 x i } = G ( 7 2 2008 7 10 1 2 2 1.1 2............................................. 2 1.2 2.......................................... 2 1.3 2........................................ 3 1.4................................................

More information

Microsoft Word - 計量研修テキスト_第5版).doc

Microsoft Word - 計量研修テキスト_第5版).doc Q9-1 テキスト P166 2)VAR の推定 注 ) 各変数について ADF 検定を行った結果 和文の次数はすべて 1 である 作業手順 4 情報量基準 (AIC) によるラグ次数の選択 VAR Lag Order Selection Criteria Endogenous variables: D(IG9S) D(IP9S) D(CP9S) Exogenous variables: C Date:

More information

waseda2010a-jukaiki1-main.dvi

waseda2010a-jukaiki1-main.dvi November, 2 Contents 6 2 8 3 3 3 32 32 33 5 34 34 6 35 35 7 4 R 2 7 4 4 9 42 42 2 43 44 2 5 : 2 5 5 23 52 52 23 53 53 23 54 24 6 24 6 6 26 62 62 26 63 t 27 7 27 7 7 28 72 72 28 73 36) 29 8 29 8 29 82 3

More information

( 30 ) 30 4 5 1 4 1.1............................................... 4 1.............................................. 4 1..1.................................. 4 1.......................................

More information

2 Tobin (1958) 2 limited dependent variables: LDV 2 corner solution 2 truncated censored x top coding censor from above censor from below 2 Heck

2 Tobin (1958) 2 limited dependent variables: LDV 2 corner solution 2 truncated censored x top coding censor from above censor from below 2 Heck 10 2 1 2007 4 6 25-44 57% 2017 71% 2 Heckit 6 1 2 Tobin (1958) 2 limited dependent variables: LDV 2 corner solution 2 truncated 50 50 censored x top coding censor from above censor from below 2 Heckit

More information

kubostat2017e p.1 I 2017 (e) GLM logistic regression : : :02 1 N y count data or

kubostat2017e p.1 I 2017 (e) GLM logistic regression : : :02 1 N y count data or kubostat207e p. I 207 (e) GLM kubo@ees.hokudai.ac.jp https://goo.gl/z9ycjy 207 4 207 6:02 N y 2 binomial distribution logit link function 3 4! offset kubostat207e (https://goo.gl/z9ycjy) 207 (e) 207 4

More information

kubostat2015e p.2 how to specify Poisson regression model, a GLM GLM how to specify model, a GLM GLM logistic probability distribution Poisson distrib

kubostat2015e p.2 how to specify Poisson regression model, a GLM GLM how to specify model, a GLM GLM logistic probability distribution Poisson distrib kubostat2015e p.1 I 2015 (e) GLM kubo@ees.hokudai.ac.jp http://goo.gl/76c4i 2015 07 22 2015 07 21 16:26 kubostat2015e (http://goo.gl/76c4i) 2015 (e) 2015 07 22 1 / 42 1 N k 2 binomial distribution logit

More information

kubostat2017b p.1 agenda I 2017 (b) probability distribution and maximum likelihood estimation :

kubostat2017b p.1 agenda I 2017 (b) probability distribution and maximum likelihood estimation : kubostat2017b p.1 agenda I 2017 (b) probabilit distribution and maimum likelihood estimation kubo@ees.hokudai.ac.jp http://goo.gl/76c4i 2017 11 14 : 2017 11 07 15:43 1 : 2 3? 4 kubostat2017b (http://goo.gl/76c4i)

More information

講義のーと : データ解析のための統計モデリング. 第5回

講義のーと :  データ解析のための統計モデリング. 第5回 Title 講義のーと : データ解析のための統計モデリング Author(s) 久保, 拓弥 Issue Date 2008 Doc URL http://hdl.handle.net/2115/49477 Type learningobject Note この講義資料は, 著者のホームページ http://hosho.ees.hokudai.ac.jp/~kub ードできます Note(URL)http://hosho.ees.hokudai.ac.jp/~kubo/ce/EesLecture20

More information

!!! 2!

!!! 2! 2016/5/17 (Tue) SPSS (mugiyama@l.u-tokyo.ac.jp)! !!! 2! 3! 4! !!! 5! (Population)! (Sample) 6! case, observation, individual! variable!!! 1 1 4 2 5 2 1 5 3 4 3 2 3 3 1 4 2 1 4 8 7! (1) (2) (3) (4) categorical

More information

こんにちは由美子です

こんにちは由美子です Sample size power calculation Sample Size Estimation AZTPIAIDS AIDSAZT AIDSPI AIDSRNA AZTPr (S A ) = π A, PIPr (S B ) = π B AIDS (sampling)(inference) π A, π B π A - π B = 0.20 PI 20 20AZT, PI 10 6 8 HIV-RNA

More information

DAA09

DAA09 > summary(dat.lm1) Call: lm(formula = sales ~ price, data = dat) Residuals: Min 1Q Median 3Q Max -55.719-19.270 4.212 16.143 73.454 Coefficients: Estimate Std. Error t value Pr(> t ) (Intercept) 237.1326

More information

H22 BioS (i) I treat1 II treat2 data d1; input group patno treat1 treat2; cards; ; run; I

H22 BioS (i) I treat1 II treat2 data d1; input group patno treat1 treat2; cards; ; run; I H BioS (i) I treat II treat data d; input group patno treat treat; cards; 8 7 4 8 8 5 5 6 ; run; I II sum data d; set d; sum treat + treat; run; sum proc gplot data d; plot sum * group ; symbol c black

More information

10

10 z c j = N 1 N t= j1 [ ( z t z ) ( )] z t j z q 2 1 2 r j /N j=1 1/ N J Q = N(N 2) 1 N j j=1 r j 2 2 χ J B d z t = z t d (1 B) 2 z t = (z t z t 1 ) (z t 1 z t 2 ) (1 B s )z t = z t z t s _ARIMA CONSUME

More information

GLM PROC GLM y = Xβ + ε y X β ε ε σ 2 E[ε] = 0 var[ε] = σ 2 I σ 2 0 σ 2 =... 0 σ 2 σ 2 I ε σ 2 y E[y] =Xβ var[y] =σ 2 I PROC GLM

GLM PROC GLM y = Xβ + ε y X β ε ε σ 2 E[ε] = 0 var[ε] = σ 2 I σ 2 0 σ 2 =... 0 σ 2 σ 2 I ε σ 2 y E[y] =Xβ var[y] =σ 2 I PROC GLM PROC MIXED ( ) An Introdunction to PROC MIXED Junji Kishimoto SAS Institute Japan / Keio Univ. SFC / Univ. of Tokyo e-mail address: jpnjak@jpn.sas.com PROC MIXED PROC GLM PROC MIXED,,,, 1 1.1 PROC MIXED

More information

tokei01.dvi

tokei01.dvi 2. :,,,. :.... Apr. - Jul., 26FY Dept. of Mechanical Engineering, Saga Univ., JAPAN 4 3. (probability),, 1. : : n, α A, A a/n. :, p, p Apr. - Jul., 26FY Dept. of Mechanical Engineering, Saga Univ., JAPAN

More information

講義のーと : データ解析のための統計モデリング. 第2回

講義のーと :  データ解析のための統計モデリング. 第2回 Title 講義のーと : データ解析のための統計モデリング Author(s) 久保, 拓弥 Issue Date 2008 Doc URL http://hdl.handle.net/2115/49477 Type learningobject Note この講義資料は, 著者のホームページ http://hosho.ees.hokudai.ac.jp/~kub ードできます Note(URL)http://hosho.ees.hokudai.ac.jp/~kubo/ce/EesLecture20

More information

(p.2 ( ) 1 2 ( ) Fisher, Ronald A.1932, 1971, 1973a, 1973b) treatment group controll group (error function) 2 (Legendre, Adrian

(p.2 ( ) 1 2 ( ) Fisher, Ronald A.1932, 1971, 1973a, 1973b) treatment group controll group (error function) 2 (Legendre, Adrian 2004 1 1 1.1 Maddala(1993) Mátyás and Sevestre (1996) Hsiao(2003) Baltagi(2001) Lee(2002) Woolridge(2002a), Arellano(2003) Journal of Econometrics Econometrica Greene(2000) Maddala(2001) Johnston and Di-

More information

事例研究(ミクロ経済政策・問題分析III) -規制産業と料金・価格制度-

事例研究(ミクロ経済政策・問題分析III) -規制産業と料金・価格制度- 事例研究 ( ミクロ経済政策 問題分析 III) - 規制産業と料金 価格制度 - ( 第 7 回 手法 (3) 応用データ解析 / 基礎的手法 ) 2010 年 6 月 2 日 戒能一成 0. 本講の目的 ( 手法面 ) - 応用データ解析の手順や基本的な作業の流れ (Strategy) を理解する - 特にグラフ化や統計検定などの手法を用いた データ解析手法の選択と検定 確認について理解する (

More information

エクセルに出力します 推定結果の表は r(table) という行列で保存されますので matlist r(table) コマンドで 得られたの一覧を表示させます. use clear. regress

エクセルに出力します 推定結果の表は r(table) という行列で保存されますので matlist r(table) コマンドで 得られたの一覧を表示させます. use   clear. regress Stata+α putexcel を使って推定結果をエクセルに出力する putexcel には様々な機能がありますが 今回は Stata の回帰分析の推定結果をエクセルに 出力します Stata での回帰分析の結果 sizplace Coef. age sex _cons.0067795 -.0872963 4.976162 Std. Err. t.0015178.0523214.1103018 4.47-1.67

More information

X X X Y R Y R Y R MCAR MAR MNAR Figure 1: MCAR, MAR, MNAR Y R X 1.2 Missing At Random (MAR) MAR MCAR MCAR Y X X Y MCAR 2 1 R X Y Table 1 3 IQ MCAR Y I

X X X Y R Y R Y R MCAR MAR MNAR Figure 1: MCAR, MAR, MNAR Y R X 1.2 Missing At Random (MAR) MAR MCAR MCAR Y X X Y MCAR 2 1 R X Y Table 1 3 IQ MCAR Y I (missing data analysis) - - 1/16/2011 (missing data, missing value) (list-wise deletion) (pair-wise deletion) (full information maximum likelihood method, FIML) (multiple imputation method) 1 missing completely

More information

A B C A B C X Y Z

A B C A B C X Y Z Argonauta 8: 27-37 (2003) 1 ANOVA, analysis of variance t 1980 90 ANOVA ANOVA Underwood, 1997 ANOVA ANOVA ANOVA 1975 Sokal & Rohlf 1981 1990 Underwood 1997 1997 Zar 1999 1-way ANOVA 2-way, 3-way, ANOVA,

More information

H22 BioS t (i) treat1 treat2 data d1; input patno treat1 treat2; cards; ; run; 1 (i) treat = 1 treat =

H22 BioS t (i) treat1 treat2 data d1; input patno treat1 treat2; cards; ; run; 1 (i) treat = 1 treat = H BioS t (i) treat treat data d; input patno treat treat; cards; 3 8 7 4 8 8 5 5 6 3 ; run; (i) treat treat data d; input group patno period treat y; label group patno period ; cards; 3 8 3 7 4 8 4 8 5

More information

Use R

Use R Use R! 2008/05/23( ) Index Introduction (GLM) ( ) R. Introduction R,, PLS,,, etc. 2. Correlation coefficient (Pearson s product moment correlation) r = Sxy Sxx Syy :, Sxy, Sxx= X, Syy Y 1.96 95% R cor(x,

More information

浜松医科大学紀要

浜松医科大学紀要 On the Statistical Bias Found in the Horse Racing Data (1) Akio NODA Mathematics Abstract: The purpose of the present paper is to report what type of statistical bias the author has found in the horse

More information

Microsoft Word - 研究デザインと統計学.doc

Microsoft Word - 研究デザインと統計学.doc Study design and the statistical basics Originality Accuracy Objectivity Verifiability Readability perfect Interdisciplinary Sciences Health Science 2014.12.25 2 1. 7 2. 7 3. Bias8 4. random sampling8

More information

R John Fox R R R Console library(rcmdr) Rcmdr R GUI Windows R R SDI *1 R Console R 1 2 Windows XP Windows * 2 R R Console R ˆ R

R John Fox R R R Console library(rcmdr) Rcmdr R GUI Windows R R SDI *1 R Console R 1 2 Windows XP Windows * 2 R R Console R ˆ R R John Fox 2006 8 26 2008 8 28 1 R R R Console library(rcmdr) Rcmdr R GUI Windows R R SDI *1 R Console R 1 2 Windows XP Windows * 2 R R Console R ˆ R GUI R R R Console > ˆ 2 ˆ Fox(2005) jfox@mcmaster.ca

More information

1 I EViews View Proc Freeze

1 I EViews View Proc Freeze EViews 2017 9 6 1 I EViews 4 1 5 2 10 3 13 4 16 4.1 View.......................................... 17 4.2 Proc.......................................... 22 4.3 Freeze & Name....................................

More information

I L01( Wed) : Time-stamp: Wed 07:38 JST hig e, ( ) L01 I(2017) 1 / 19

I L01( Wed) : Time-stamp: Wed 07:38 JST hig e,   ( ) L01 I(2017) 1 / 19 I L01(2017-09-20 Wed) : Time-stamp: 2017-09-20 Wed 07:38 JST hig e, http://hig3.net ( ) L01 I(2017) 1 / 19 ? 1? 2? ( ) L01 I(2017) 2 / 19 ?,,.,., 1..,. 1,2,.,.,. ( ) L01 I(2017) 3 / 19 ? I. M (3 ) II,

More information

Presentation Title Goes Here

Presentation  Title Goes Here SAS 9: (reprise) SAS Institute Japan Copyright 2004, SAS Institute Inc. All rights reserved. Greetings, SAS 9 SAS 9.1.3 Copyright 2004, SAS Institute Inc. All rights reserved. 2 Informations of SAS 9 SAS

More information

Isogai, T., Building a dynamic correlation network for fat-tailed financial asset returns, Applied Network Science (7):-24, 206,

Isogai, T., Building a dynamic correlation network for fat-tailed financial asset returns, Applied Network Science (7):-24, 206, H28. (TMU) 206 8 29 / 34 2 3 4 5 6 Isogai, T., Building a dynamic correlation network for fat-tailed financial asset returns, Applied Network Science (7):-24, 206, http://link.springer.com/article/0.007/s409-06-0008-x

More information

DAA12

DAA12 Observed Data (Total variance) Predicted Data (prediction variance) Errors in Prediction (error variance) Shoesize 23 24 25 26 27 male female male mean female mean overall mean Shoesize 23 24 25 26 27

More information

(pdf) (cdf) Matlab χ ( ) F t

(pdf) (cdf) Matlab χ ( ) F t (, ) (univariate) (bivariate) (multi-variate) Matlab Octave Matlab Matlab/Octave --...............3. (pdf) (cdf)...3.4....4.5....4.6....7.7. Matlab...8.7.....9.7.. χ ( )...0.7.3.....7.4. F....7.5. t-...3.8....4.8.....4.8.....5.8.3....6.8.4....8.8.5....8.8.6....8.9....9.9.....9.9.....0.9.3....0.9.4.....9.5.....0....3

More information

kubostat7f p GLM! logistic regression as usual? N? GLM GLM doesn t work! GLM!! probabilit distribution binomial distribution : : β + β x i link functi

kubostat7f p GLM! logistic regression as usual? N? GLM GLM doesn t work! GLM!! probabilit distribution binomial distribution : : β + β x i link functi kubostat7f p statistaical models appeared in the class 7 (f) kubo@eeshokudaiacjp https://googl/z9cjy 7 : 7 : The development of linear models Hierarchical Baesian Model Be more flexible Generalized Linear

More information

untitled

untitled WinLD R (16) WinLD https://www.biostat.wisc.edu/content/lan-demets-method-statistical-programs-clinical-trials WinLD.zip 2 2 1 α = 5% Type I error rate 1 5.0 % 2 9.8 % 3 14.3 % 5 22.6 % 10 40.1 % 3 Type

More information

分布

分布 (normal distribution) 30 2 Skewed graph 1 2 (variance) s 2 = 1/(n-1) (xi x) 2 x = mean, s = variance (variance) (standard deviation) SD = SQR (var) or 8 8 0.3 0.2 0.1 0.0 0 1 2 3 4 5 6 7 8 8 0 1 8 (probability

More information

第2回:データの加工・整理

第2回:データの加工・整理 2 2018 4 13 1 / 24 1. 2. Excel 3. Stata 4. Stata 5. Stata 2 / 24 1 cross section data e.g., 47 2009 time series data e.g., 1999 2014 5 panel data e.g., 47 1999 2014 5 3 / 24 micro data aggregate data 4

More information

R分散分析06.indd

R分散分析06.indd http://cse.niaes.affrc.go.jp/minaka/r/r-top.html > mm mm TRT DATA 1 DM1 2537 2 DM1 2069 3 DM1 2104 4 DM1 1797 5 DM2 3366 6 DM2 2591 7 DM2 2211 8 DM2

More information

Microsoft Word - 計量研修テキスト_第5版).doc

Microsoft Word - 計量研修テキスト_第5版).doc Q8-1 テキスト P131 Engle-Granger 検定 Dependent Variable: RM2 Date: 11/04/05 Time: 15:15 Sample: 1967Q1 1999Q1 Included observations: 129 RGDP 0.012792 0.000194 65.92203 0.0000 R -95.45715 11.33648-8.420349

More information

Studies of Foot Form for Footwear Design (Part 9) : Characteristics of the Foot Form of Young and Elder Women Based on their Sizes of Ball Joint Girth

Studies of Foot Form for Footwear Design (Part 9) : Characteristics of the Foot Form of Young and Elder Women Based on their Sizes of Ball Joint Girth Studies of Foot Form for Footwear Design (Part 9) : Characteristics of the Foot Form of Young and Elder Women Based on their Sizes of Ball Joint Girth and Foot Breadth Akiko Yamamoto Fukuoka Women's University,

More information

計量経済分析 2011 年度夏学期期末試験 担当 : 別所俊一郎 以下のすべてに答えなさい. 回答は日本語か英語でおこなうこと. 1. 次のそれぞれの記述が正しいかどうか判定し, 誤りである場合には理由, あるいはより適切な 記述はどのようなものかを述べなさい. (1) You have to wo

計量経済分析 2011 年度夏学期期末試験 担当 : 別所俊一郎 以下のすべてに答えなさい. 回答は日本語か英語でおこなうこと. 1. 次のそれぞれの記述が正しいかどうか判定し, 誤りである場合には理由, あるいはより適切な 記述はどのようなものかを述べなさい. (1) You have to wo 計量経済分析 2011 年度夏学期期末試験 担当 : 別所俊一郎 以下のすべてに答えなさい. 回答は日本語か英語でおこなうこと. 1. 次のそれぞれの記述が正しいかどうか判定し, 誤りである場合には理由, あるいはより適切な 記述はどのようなものかを述べなさい. (1) You have to worry about perfect multicollinearity in the multiple

More information

201711grade2.pdf

201711grade2.pdf 2017 11 26 1 2 28 3 90 4 5 A 1 2 3 4 Web Web 6 B 10 3 10 3 7 34 8 23 9 10 1 2 3 1 (A) 3 32.14 0.65 2.82 0.93 7.48 (B) 4 6 61.30 54.68 34.86 5.25 19.07 (C) 7 13 5.89 42.18 56.51 35.80 50.28 (D) 14 20 0.35

More information

1 kawaguchi p.1/81

1 kawaguchi p.1/81 1 kawaguchi atsushi@kurume-u.ac.jp 2005 7 2 p.1/81 2.1 2.2 2.2.3 2.3 AUC 4.4 p.2/81 X Z X = α + βz + e α : Z = 0 X ( ) β : Z X ( ) e : 0 σ 2 p.3/81 2.1 Z X 1 0.045 2 0.114 4 0.215 6 0.346 7 0.41 8 0.52

More information

untitled

untitled IT (1, horiike@ml.me.titech.ac.jp) (1, jun-jun@ms.kagu.tus.ac.jp) 1. 1-1 19802000 2000ITIT IT IT TOPIX (%) 1TOPIX 2 1-2. 80 80 ( ) 2004/11/26 S-PLUS 2 1-3. IT IT IT IT 2. 2-1. a. b. (Size) c. B/M(Book

More information

5 Armitage x 1,, x n y i = 10x i + 3 y i = log x i {x i } {y i } 1.2 n i i x ij i j y ij, z ij i j 2 1 y = a x + b ( cm) x ij (i j )

5 Armitage x 1,, x n y i = 10x i + 3 y i = log x i {x i } {y i } 1.2 n i i x ij i j y ij, z ij i j 2 1 y = a x + b ( cm) x ij (i j ) 5 Armitage. x,, x n y i = 0x i + 3 y i = log x i x i y i.2 n i i x ij i j y ij, z ij i j 2 y = a x + b 2 2. ( cm) x ij (i j ) (i) x, x 2 σ 2 x,, σ 2 x,2 σ x,, σ x,2 t t x * (ii) (i) m y ij = x ij /00 y

More information

Microsoft Word - StatsDirectMA Web ver. 2.0.doc

Microsoft Word - StatsDirectMA Web ver. 2.0.doc Web version. 2.0 15 May 2006 StatsDirect ver. 2.0 15 May 2006 2 2 2 Meta-Analysis for Beginners by using the StatsDirect ver. 2.0 15 May 2006 Yukari KAMIJIMA 1), Ataru IGARASHI 2), Kiichiro TSUTANI 2)

More information

2004 2 µ i ν it IN(0, σ 2 ) 1 i ȳ i = β x i + µ i + ν i (2) 12 y it ȳ i = β(x it x i ) + (ν it ν i ) (3) 3 β 1 µ i µ i = ȳ i β x i (4) (least square d

2004 2 µ i ν it IN(0, σ 2 ) 1 i ȳ i = β x i + µ i + ν i (2) 12 y it ȳ i = β(x it x i ) + (ν it ν i ) (3) 3 β 1 µ i µ i = ȳ i β x i (4) (least square d 2004 1 3 3.1 1 5 1 2 3.2 1 α = 0, λ t = 0 y it = βx it + µ i + ν it (1) 1 (1995)1998Fujiki and Kitamura (1995). 2004 2 µ i ν it IN(0, σ 2 ) 1 i ȳ i = β x i + µ i + ν i (2) 12 y it ȳ i = β(x it x i ) +

More information

.001 nonsmoker smoker 0 Density 5.0e infant birthweight (grams) Graphs by 1 if mother smoked 図 2. 新生児体重のヒストグラム (

.001 nonsmoker smoker 0 Density 5.0e infant birthweight (grams) Graphs by 1 if mother smoked 図 2. 新生児体重のヒストグラム ( 第一回はじめての傾向スコア分析 これから 3 回にわたって傾向スコア分析について説明します 各回の内容は以下の通りです 第一回はじめての傾向スコア分析第二回分析後のチェック第三回 Abadie and Imbens(2011) の貢献 Stata14 をまだお持ちでない方は是非 デモ版をダウンロードしてお試しください 理屈はともかく 一度 傾向スコア分析をやってみましょう 次に示すようにコマンド ウィンドウにコマンドを直接入力して

More information

Microsoft Word - 計量研修テキスト_第5版).doc

Microsoft Word - 計量研修テキスト_第5版).doc Q4-1 テキスト P83 多重共線性が発生する回帰 320000 280000 240000 200000 6000 4000 160000 120000 2000 0-2000 -4000 74 76 78 80 82 84 86 88 90 92 94 96 98 R e s i dual A c tual Fi tted Dependent Variable: C90 Date: 10/27/05

More information

June 2016 i (statistics) F Excel Numbers, OpenOffice/LibreOffice Calc ii *1 VAR STDEV 1 SPSS SAS R *2 R R R R *1 Excel, Numbers, Microsoft Office, Apple iwork, *2 R GNU GNU R iii URL http://ruby.kyoto-wu.ac.jp/statistics/training/

More information

σ t σ t σt nikkei HP nikkei4csv H R nikkei4<-readcsv("h:=y=ynikkei4csv",header=t) (1) nikkei header=t nikkei4csv 4 4 nikkei nikkei4<-dataframe(n

σ t σ t σt nikkei HP nikkei4csv H R nikkei4<-readcsv(h:=y=ynikkei4csv,header=t) (1) nikkei header=t nikkei4csv 4 4 nikkei nikkei4<-dataframe(n R 1 R R R tseries fseries 1 tseries fseries R Japan(Tokyo) R library(tseries) library(fseries) 2 t r t t 1 Ω t 1 E[r t Ω t 1 ] ɛ t r t = E[r t Ω t 1 ] + ɛ t ɛ t 2 iid (independently, identically distributed)

More information

鉄鋼協会プレゼン

鉄鋼協会プレゼン NN :~:, 8 Nov., Adaptive H Control for Linear Slider with Friction Compensation positioning mechanism moving table stand manipulator Point to Point Control [G] Continuous Path Control ground Fig. Positoining

More information

9 8 7 (x-1.0)*(x-1.0) *(x-1.0) (a) f(a) (b) f(a) Figure 1: f(a) a =1.0 (1) a 1.0 f(1.0)

9 8 7 (x-1.0)*(x-1.0) *(x-1.0) (a) f(a) (b) f(a) Figure 1: f(a) a =1.0 (1) a 1.0 f(1.0) E-mail: takio-kurita@aist.go.jp 1 ( ) CPU ( ) 2 1. a f(a) =(a 1.0) 2 (1) a ( ) 1(a) f(a) a (1) a f(a) a =2(a 1.0) (2) 2 0 a f(a) a =2(a 1.0) = 0 (3) 1 9 8 7 (x-1.0)*(x-1.0) 6 4 2.0*(x-1.0) 6 2 5 4 0 3-2

More information

自由集会時系列part2web.key

自由集会時系列part2web.key spurious correlation spurious regression xt=xt-1+n(0,σ^2) yt=yt-1+n(0,σ^2) n=20 type1error(5%)=0.4703 no trend 0 1000 2000 3000 4000 p for r xt=xt-1+n(0,σ^2) random walk random walk variable -5 0 5 variable

More information