Stata program for Probit/Logit Models


Program for Duration Data


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

Program for Duration Data
Surv_data.do
* this data set has married males, aged 50-70;
* from the nhis multiple cause of death file;
* data is taken from the 1987-1990 nhis;
* surveys. all people are followed for;
* up to 60 months. max_mths is the most;
* people are followed and diedin5;
* indicates whether the person died;
* in five years (60 months);
* set end of line marker;
# delimit;
set more off;

* increase memory;


set memory 20m;

* write results to file;


log using c:\bill\jpsm\surv_data.log,replace;

* load up sas data set;


use c:\bill\jpsm\surv_data;

* get contents of data file;


desc;

* get summary statistics;


sum;

* define the duration data in the analysis;


stset max_mths, failure(diedin5);

* list the kaplan meier survivor function;


sts list;

* you can graph the functions as well;


* output the graphs to a file;
sts graph;
graph save c:\bill\jpsm\graph1.gph, replace;

* you can draw graphs for various subgroups;


* output the graphs to a file;
sts graph, by(educ);
graph save c:\bill\jpsm\graph2.gph, replace;

* run a duration model where the hazard varies across;


* people. first, ask stata to print out the raw;
* coefficients (nohr option), then do default;
* show weibull first, then exponential;

* first, construct dummies for the income and;


* education categories. in the regression statement;
* _Ie star include all variables beginning with _Ie;
* and _Ii star includes all variables starting with;
* _Ii;

xi i.income i.educ;


streg age_s_yrs black hispanic _Ie* _Ii*, d(weibull) nohr;


* now get the hazard ratios where all coefs are raised to;


* exp(b1);

streg age_s_yrs black hispanic _Ie* _Ii*, d(weibull);


* for compairson purposes, look at results from an exponential;
streg age_s_yrs black hispanic _Ie* _Ii*, d(exp) nohr;
streg age_s_yrs black hispanic _Ie* _Ii*, d(exp);
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