![]() Once the data is sorted then you summarize the variable by typing: First you need to sort the data by city by typing: In order to calculate the frequency of arrests by city you will need to use the sort command. You also can combine this command with logical statements or restrict the range of observations. This command reports the frequency associated with each value of arrests in the sample. The sample can be restricted to certain observation ranges by using the in m/n option, just as illustrated in the list command:įor variables that take on a relatively small number of values - such as number of children or number of times an individual was arrested during a year - you can use the tab command to get frequency tabulation: If the data is a pooled cross section or a panel data set, to summarize for 1990 type: Stata also provides summary statistics for any subgroup of the sample if you add a logical statement: To obtain more summary information for each of these variables you must type:īy adding the detail option, Stata provides an extensive list of summary statistics for each of these variables including the median and other percentiles of the empirical distribution. The average value reported is simply the proportion of people in the sample who are married. Because married is a binary variable, its minimum and maximum values are not very interesting. Thus, the command:Ĭomputes the summary statistics for the four variables listed. Because this command tells you how many observations were used for each variable in computing the summary statistics, you can easily find out how many missing data points there are for any variable. The sum command computes the sample average, standard deviation, and the minimum and maximum values of all (nonmissing) observations. Two useful commands for summarizing data are the sum and tab commands. (Logical and is denoted by “&” and logical or is denoted by " |" in Stata.). Restricts attention to union members who work at least 40 hours a week. Reg lwage edu exp expsq tenu union if edu (greater than), = (greater than or equal), = 40 Sometimes we want to restrict our regression analysis based on the size of one or more of the variables. If a variable called "motheduc" (mother's education) is added to the independent variables in the above regression, and this variable is missing for say 10 percent of individuals, then the sample size using in obtaining OLS estimates is decreased accordingly. Thus, you must he aware that adding another explanatory variable can result in fewer observations used in the regression if some observations are missing for that variable. It does not use observations for which data on the dependent or any of the independent variables is missing. Unless a specific range of observations or logical statement is included, Stata uses all possible observations in obtaining estimates. This command produces OLS estimates, standard errors, t statistics, confidence intervals, and a variety of other statistics usually reported with OLS output. Immediately following reg is the dependent variable, and after that, all of the independent variables (order of the independent variables is not, of course, important). gen ccrime = crime - crime if year = 1987įor OLS regression, we use the command reg.sum wage edu tenu married if year =1990.list married age if union=1 & hours >= 40.Creating log (procedure and output) file.Using Stata as a Calculator and Computing p-values.vif Calculate VIFs (variance inflation factors). #Does not equal sign stata series#dwstat Compute Durbin-Watson d statistic if the data is declared as time series.ovtest Perform Ramsey RESET test for omitted variable test.rvpplot Graph residual-versus-predictor plot.rvfplot Graph residual-versus-fitted plot.Seemingly Unrelated Regression Models.Autoregressive Integrated Moving Average (ARIMA): arima.Time series operators: reg consume gnp L.gnp L2.gnp D.gnp D2.gnp S2.gnp.Generating lags and leads : gen xlag1= x.xtreg lwage edu exp expsq tenu union, be.xtreg lwage edu exp expsq tenu union, re.xtreg lwage edu exp expsq tenu union, fe.ivreg lwage (edu =married) exp expsq tenu union.Instrumental Variable (Two Stage Least Squares).reg lwage educ exper expersq married black, robust. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |