Stata program for Probit/Logit Models


Download 230.5 Kb.
bet1/9
Sana23.03.2023
Hajmi230.5 Kb.
#1287378
  1   2   3   4   5   6   7   8   9
Bog'liq
STATA Programs


STATA Program for OLS
cps87_or.do

* the data for this project is a small subsample;


* of full time (30 or more hours) male workers;
* aged 21-64 from the out going rotation;
* samples of the 1987 current population survey;
* this line defines the semicolon as the ;
* end of line delimiter;
# delimit ;

* set memork for 10 meg;


set memory 10m;
* write results to a log file;
* the replace options writes over old;
* log files;
log using cps87_or.log,replace;

* open stata data set;


use c:\bill\stata\cps87_or;

* list variables and labels in data set;


desc;

* generate new variables;


* lines 1-2 illustrate basic math functoins;
* lines 3-4 line illustrate logical operators;
* line 5 illustrate the OR statement;
* line 6 illustrates the AND statement;
* after you construct new variables, compress the data again;
gen age2=age*age;
gen earnwkl=ln(earnwke);
gen union=unionm==1;
gen topcode=earnwke==999;
gen nonwhite=((race==2)|(race==3));
gen big_ne=((region==1)&(smsa==1));

* label the data;


label var age2 "age squared";
label var earnwkl "log earnings per week";
label var topcode "=1 if earnwkl is topcoded";
label var union "1=in union, 0 otherwise";
label var nonwhite "1=nonwhite, 0=white" ;
label var big_ne "1= live in big smsa from northeast, 0=otherwsie";

* get descriptive statistics;


sum;

* get detailed descriptics for continuous variables;


sum earnwke, detail;
* get frequencies of discrete variables;
tabulate unionm;
tabulate race;

* get two-way table of frequencies;


tabulate region smsa, row column cell;

*run simple regression;


reg earnwkl age age2 educ nonwhite union;

* run regression addinf smsa, region and race fixed-effects;


* the xi command constructs the dummies for you;
* the lowest numbered dummy is usually the;
* omitted variable;
xi: reg earnwkl age age2 educ union i.race i.region i.smsa;
more;

* close log file;


log close;

Download 230.5 Kb.

Do'stlaringiz bilan baham:
  1   2   3   4   5   6   7   8   9




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling