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
|
|
|
- しほこ はなだて
- 7 years ago
- Views:
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: [email protected]
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(
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
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
こんにちは由美子です
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
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
最小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) ( )
第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
% 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.
卒業論文
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
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
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
.. 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
第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 = β
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,
こんにちは由美子です
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
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.
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
Rによる計量分析:データ解析と可視化 - 第3回 Rの基礎とデータ操作・管理
R 3 R 2017 Email: [email protected] 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.)
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
kubostat2017c p (c) Poisson regression, a generalized linear model (GLM) : :
kubostat2017c p.1 2017 (c), a generalized linear model (GLM) : [email protected] 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
こんにちは由美子です
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
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 [email protected] 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)
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
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,
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) [email protected] 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....................
: (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.
¥¤¥ó¥¿¡¼¥Í¥Ã¥È·×¬¤È¥Ç¡¼¥¿²òÀÏ Âè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
講義のーと : データ解析のための統計モデリング. 第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
<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
一般化線形 (混合) モデル (2) - ロジスティック回帰と GLMM
.. ( ) (2) GLMM [email protected] 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!
1 15 R Part : website:
1 15 R Part 4 2017 7 24 4 : website: email: http://www3.u-toyama.ac.jp/kkarato/ [email protected] 1 2 2 3 2.1............................... 3 2.2 2................................. 4 2.3................................
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:
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
( 30 ) 30 4 5 1 4 1.1............................................... 4 1.............................................. 4 1..1.................................. 4 1.......................................
kubostat2017e p.1 I 2017 (e) GLM logistic regression : : :02 1 N y count data or
kubostat207e p. I 207 (e) GLM [email protected] 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
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 [email protected] http://goo.gl/76c4i 2017 11 14 : 2017 11 07 15:43 1 : 2 3? 4 kubostat2017b (http://goo.gl/76c4i)
講義のーと : データ解析のための統計モデリング. 第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
!!! 2!
2016/5/17 (Tue) SPSS ([email protected])! !!! 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
こんにちは由美子です
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
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
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
講義のーと : データ解析のための統計モデリング. 第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
(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-
エクセルに出力します 推定結果の表は 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
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
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,
浜松医科大学紀要
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
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) [email protected]
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....................................
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
分布
(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
第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
.3 ˆβ1 = S, S ˆβ0 = ȳ ˆβ1 S = (β0 + β1i i) β0 β1 S = (i β0 β1i) = 0 β0 S = (i β0 β1i)i = 0 β1 β0, β1 ȳ β0 β1 = 0, (i ȳ β1(i ))i = 0 {(i ȳ)(i ) β1(i ))
Copright (c) 004,005 Hidetoshi Shimodaira 1.. 3. 4. 004-10-01 16:15:07 shimo cat(" 1: "); c(mea(), mea()) cat(" : "); mmea
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
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,
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
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 ) +
.001 nonsmoker smoker 0 Density 5.0e infant birthweight (grams) Graphs by 1 if mother smoked 図 2. 新生児体重のヒストグラム (
第一回はじめての傾向スコア分析 これから 3 回にわたって傾向スコア分析について説明します 各回の内容は以下の通りです 第一回はじめての傾向スコア分析第二回分析後のチェック第三回 Abadie and Imbens(2011) の貢献 Stata14 をまだお持ちでない方は是非 デモ版をダウンロードしてお試しください 理屈はともかく 一度 傾向スコア分析をやってみましょう 次に示すようにコマンド ウィンドウにコマンドを直接入力して
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
σ 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)
自由集会時系列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
