* * Example 20.5 * J. Wooldridge, Econometrics of Cross Section and Panel Data * * Note: The sample data files include all required data transformations. * However, in many cases we show how these data transformations would * be created in RATS from the basic data, as this is something you will * need to know how to do in practice. * open data recid.raw data(format=free,org=columns) 1 1445 black alcohol drugs super married felon workprg property $ person priors educ rules age tserved follow durat cens ldurat * * Define the linear parametric part of the hazard function. The free parameters * will be in the vector b. * frml(regressors,vector=b) zfrml # workprg priors tserved felon alcohol drugs black married educ age constant * nonlin b alpha compute b=%const(0.0),alpha=1.0 * * The data are censored at varying durations. The "cens" variable is a dummy * which shows whether a particular observation was censored. The likelihood * element takes different forms for censored and uncensored observations. * * Note that the log likelihood value doesn't quite match with that shown in the * text. If the (alpha-1) in the second line of the formula is replaced by just * alpha, you'll get the same results as shown in the text. * frml weibull = (z=zfrml),(w=-exp(z)*durat**alpha),$ %if(cens,w,z+log(alpha)+(alpha-1)*log(durat)+w) maximize(method=bfgs,iters=200) weibull