Chapter Contents |
Previous |
Next |
The LIFEREG Procedure |
Consider a continuous random variable Y, and a constant C. If you were to sample from the distribution of Y but discard values less than (greater than) C, the distribution of the remaining observations would be truncated on the left (right). If you were to sample from the distribution of Y and report values less than (greater than) C as C, the distribution of the sample would be left (right) censored.
The probability density function of the truncated random variable Y' is given by
Suppose the model being fit is specified as follows:
Define the censored random variable Yi as
You can use the LIFEREG procedure to compute predicted values based on the mean functions of the latent and observed variables. The mean of the latent variable is and you can compute values of the mean for different settings of xi by specifying XBETA=variable-name in an OUTPUT statement. Estimates of for each observation will be written to the OUT= data set. Predicted values of the observed variable Yi can be computed based on the mean
The following table shows a subset of the Mroz (1987) data set. In this data, Hours is the number of hours the wife worked outside the household in a given year, Yrs_Ed is the years of education, and Yrs_Exp is the years of work experience. A Tobit model will be fit to the hours worked with years of education and experience as covariates.
Hours | Yrs_Ed | Yrs_Exp |
0 | 8 | 9 |
0 | 8 | 12 |
0 | 9 | 10 |
0 | 10 | 15 |
0 | 11 | 4 |
0 | 11 | 6 |
1000 | 12 | 1 |
1960 | 12 | 29 |
0 | 13 | 3 |
2100 | 13 | 36 |
3686 | 14 | 11 |
1920 | 14 | 38 |
0 | 15 | 14 |
1728 | 16 | 3 |
1568 | 16 | 19 |
1316 | 17 | 7 |
0 | 17 | 15 |
If the wife was not employed (worked 0 hours), her hours worked will be left censored at zero. In order to accommodate left censoring in PROC LIFEREG, you need two variables to indicate censoring status of observations. You can think of these variables as lower and upper endpoints of interval censoring. If there is no censoring, set both variables to the observed value of Hours. To indicate left censoring, set the lower endpoint to missing and the upper endpoint to the censored value, zero in this case.
The following statements create a SAS data set with the variables Hours, Yrs_Ed, and Yrs_Exp from the data above. A new variable, Lower is created such that Lower=. if Hours=0 and Lower=Hours if Hours>0.
data subset; input Hours Yrs_Ed Yrs_Exp @@; if Hours eq 0 then Lower=.; else Lower=Hours; datalines; 0 8 9 0 8 12 0 9 10 0 10 15 0 11 4 0 11 6 1000 12 1 1960 12 29 0 13 3 2100 13 36 3686 14 11 1920 14 38 0 15 14 1728 16 3 1568 16 19 1316 17 7 0 17 15 ;The following statements fit a normal regression model to the left censored Hours data using Yrs_Ed and Yrs_Exp as covariates. You will need the estimated standard deviation of the normal distribution to compute the predicted values of the censored distribution from the formulas above. The data set OUTEST contains the standard deviation estimate in a variable named _SCALE_. You also need estimates of . These are contained in the data set OUT as the variable Xbeta
proc lifereg data=subset outest=OUTEST(keep=_scale_); model (lower, hours) = yrs_ed yrs_exp / d=normal; output out=OUT xbeta=Xbeta; run;Output 36.2.1 shows the results of the model fit. These tables show parameter estimates for the uncensored, or latent variable, distribution. Output 36.2.1: Parameter Estimates from PROC LIFEREG
data predict; drop lambda _scale_ _prob_; set out; if _n_ eq 1 then set outest; lambda = pdf('NORMAL',Xbeta/_scale_) / cdf('NORMAL',Xbeta/_scale_); Predict = cdf('NORMAL', Xbeta/_scale_) * (Xbeta + _scale_*lambda); label Xbeta='MEAN OF UNCENSORED VARIABLE' Predict = 'MEAN OF CENSORED VARIABLE'; run; proc print data=predict noobs label; var hours lower yrs: xbeta predict; run;Output 36.2.2 shows the original variables, the predicted means of the uncensored distribution, and the predicted means of the censored distribution. Output 36.2.2: Predicted Means from PROC LIFEREG
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.