Microeconometrics Using Stata |
v:i Contents
1.5 Scalars and matrices 1 5 1.5.1 Scalars . 1 5 1 .5.2 Matrices 15 1.6 Using results from Stata commands . 16 1 .6.1 Using results from the r-class command summarize 16 1.6.2 Using results from the e-class command regress 17 1.7 Global and local macros 19 1.7.1 Global macros 19 1.7.2 Local m acros 20 1 .7.3 Scalar or macro? 21 1.8 Looping commands . . . . 22 1 .8.1 The foreach loop 23 1.8.2 The forvalues loop 23 1.8.3 The while loop 24 1.8.4 The continue command 0 24 1. 9 Some useful commands 0 24 1 . 10 Template do-file . . . . 0 25 1.11 User-written commands ')_􀟒;:> 1. 12 Stata resources 26 1 .13 Exercises 0 0 . . 26 2 Data management and graphics 29 2.1 Introduction . 29 2.2 Types of data 29 2.201 Text or ASCII data 0 30 2.2.2 Internal numeric data . 30 2.2.3 String data . . . . . . 31 2.2.4 Formats for· displaying num eric data 31 2.3 Inputting data . . . . . . . 32 2.3.1 General principles 0 32 2.3.2 Inputting data already in Stata format 33 Contents vii 2.3.3 Inputting data from the keyboard . 34 2.3.4 Inputting nontext data . . . . . . . 34 2.3.5 Inputting text data from a spreadsheet 35 2.3.6 Inputting text data in free format . 36 2.3.7 Inputting text data in fixed format 36 ·2.3.8 Dictionary files 37 2.3.9 Common pitfalls 37 2.4 Data management ... 38 2.4. 1 PSID example . 38 2.4.2 Naming and labeling variables 41 2.4.3 Viewing data . . . . . . . . . 42 2.4.4 Using original documentation 43 2.4.5 Missing values . . . . . 43 2.4.6 Imputing missing data 45 2. 4. 7 Transforming data (generate, replace, egen, recode) 45 The generate and replace commands 46 The egen command . . 46 The recode command . 47 The by prefix . . . 47 Indicator variables 47 Set of indicator variables 48 Interactions 49 Demeaning . 50 2.4.8 S aving data 51 2.4.9 Selecting the sample 51 2.5 Manipulating datasets . . . . 53 2.5.1 Ordering observations and variables . 53 2.5.2 Preserving and restoring a dataset 53 2.5.3 Wide and long forms for a dataset 54 viii Contents 2.5.4 Merging datasets . . 54 2.5.5 Appending datasets . 56 2.6 Graphical display of data . . 57 2. 6.1 Stata graph commands 57 Example graph commands 57 Saving and exporting graphs . 58 Learning how to use graph commands 59 2.6.2 Box-and-whisker plot 60 2.6.3 Histogram . . . . . 61 2.6.4 Kernel density plot 62 2.6.5 Twoway scatterplots and fitted lines 64 2.6.6 Lowess, kernel, local linear, and nearest-neighbor regression 65 2.6.7 Multiple scatterplots 67 2.7 Stata resources 68 2.8 Exercises . . . . 68 3 Linear regression basics 71 3.1 Introduction . . . . . 71 3.2 Data and data summary 71 3.2.1 Data description 71 3.2.2 Variable description . 72 3.2.3 Summary statistics 73 3.2.4 More-detailed summary statistics 74 3. 2.5 Tables for data 75 3.2.6 Statistical tests 78 3.2.7 Data plots . . . 78 3.3 Regression in levels and logs . 79 3.3.1 Basic regression theory 79 3.3.2 OLS regression and matrix algebra 80 3.3.3 Properties of the OLS estimator . . 81 3.3.4 Heteroskedasticity-robust standard errors 82 Contents Cluster-robust standard errors Regression in logs 3.4 Basic regression analysis Correlations . . The regress command Hypothesis tests . . . . Tables of output from several regressions Even better tables or" regression output 3.5 Specification analysis . . . . . . . . . . . . . . . Specification tests and model diagnostics . · Residual diagnostic plots . Influential observations Specification tests . . . Test of omitted variables Test of the Box-Cox model Test of the functional form of the conditional mean Heteroskedasticity test Omnibus test . . . . . 3.5.5 Tests have power in more than one direction 3.6 Prediction . . . . . . . . . . . 3.6.1. In-sample prediction 3.6.2 Marginal effects 0 . . 3.6.3 Prediction in logs: The retransformation problem 306.4 Prediction exercise 3.7 Sampling weights Weights Weighted mean Weighted regression 0 3.7.4 Weighted prediction and MEs 3.8 OLS usirig Mata . . o o • • • • • • • • 4 3.9 Stata resources 3.10 Exercises . Simulation 4.1 Introduction . 4.2 Pseudorandom-number generators: Introduction Uniform random-number generation Draws from normal . . . . . . . . . . Draws from t, chi-squared, F, gamma, and beta Draws from binomial, Poisson, and negative binomial . Independent (but not identically distributed) draws from Contents binomial . . . . . . . . . . . . . . . . . . . . . . 118 Independent (but not identically distributed) draws from Poisson . . . . . . . 119 Histograms and density plots 120 4.3 Distribution of t he sample mean Stata program . . . . . . The simulate command . Central limit theorem simulation The postfile command . . . . . . Alternative central limit theorem simulation 4.4 Pseudorandom-number generators: Further details Inverse-probability transformation . Direct transformation . Other methods . . . . Draws from truncated normal Draws from multivariate normal . Direct draws from multivariate normal 'I\:an.sformation using Cholesky decomposition Draws using Markov chain Monte Carlo method . 4.5 Computing integrals 4.5.1 Quadrature Contents 5 Monte Carlo integration . . . . . . . . . . Monte Carlo integration using different S . 4.6 Simulation for regression: Introduction . . . . . . 4.6.1 Simulation example: OLS with x2 errors Interpreting simulation output . Unbiasedness of estimator Standard errors t statistic Test size Number of simulations Variations . . . . . . . Different sample size and number of simulations . Test power . . . . . . . . . . Different error distributions Estimator inconsistency . . Simulation with endogenous regressors 4. 7 Stata resources 4.8 Exercises . . GLS regression 5.1 5.2 Introduction . GLS .1:1. .nd FGLS regression 5.2. 1 GLS for heteroskedastic errors . 5.2.2 GLS a.nd FGLS . . . . . . . . . Weighted least squares and robust standard errors Leading examples . . . 5.3 Modeling heteroskedastic data . 5.3.1 Simulated dataset . 5.3.2 OLS estimation . . 5.3.3 Detecting heteroskedasticity 5.3.4 FGLS estimation . . . . . . 5.3.5 WLS estimation . . System of linear regressions 5.4.1 SUR model . . . . The sureg command Application to two categories of expenditures Robust standard errors . . . . . . . 5.4.5 Testing cross-equation constraints . 5.4.6 Imposing cross-equation constraints . Survey data: Weighting, clustering, and stratification . 5.5.1 Survey design . . . . . . 5.5.2 Survey mean estimation 5.5.3 Survey linear regression 5 .6 Stata resources 5.7 Exercises . . . . Linear instrumental-variables regression 6.1 Introduction . 6.2 IV estimation 6.2.1 Ba8ic IV theory 6.2.2 Model setup . IV estimators: IV, 2SLS, and GMM Instrument validity and relevance Robust standard-error estimates . 6.3 IV example . . . . . . . . . . . . 6.3.1 The ivregress command Medical expenditures with one endogenous regressor Available instruments . . . . . . . . . . . . . IV estimation of an exactly identified model IV estimation of an overidentified model Testing for regressor endogeneity . Tests of overidentifying restrictions 链接:https://pan.baidu.com/s/19zNG2F7iXbi-2YSuLx_S-A
购买主题
本主题需向作者支付 50 个金币 才能浏览
|
联系我们|Free考研资料 ( 苏ICP备05011575号 )
GMT+8, 24-12-2 05:41 , Processed in 0.244891 second(s), 12 queries , Gzip On, Xcache On.
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.