Clint Thompson <[email protected]> asks:
> I'm using STATA v8 and when I use the 'predict' command for the
> median and the standard error of the Weibull distribution the
> same value is returned. The code that precedes the 'predict'
> command is pasted below:
> stset time
> streg, dist(weibull)
> nlcom (theta:exp([ln_p]_b[_cons])) (beta:exp(-b[_cons]))
> For predict, I used the following code:
> predict med
> predict stdp
As Rich Goldstein <[email protected]> has pointed out, you have an error
in your use of the -predict- syntax. In any case, even if you typed
. predict stdp, stdp
you would not get the standard error of the predicted median.
This will instead give you the standard error of the linear predictor
which, in this case, is not equal to the predicted median. To get the
standard error of this "nonlinear" prediction, you need -predictnl-. Also,
since you are only interested in the predicted median time, the
reparamterization using -nlcom- is not necessary -- you can work with
-streg-'s original parameterization.
The following will give you what you need.
. stset time
. streg, dist(weibull)
. predictnl med = predict(time median) in 1, se(med_se)
. list med med_se in 1
which will store the predicted median in the first observation of -med-, and
its standard error in the first observation of -med_se-. You can safely
ignore the "prediction is constant over observations..." warning from
-predictnl-, since in your case you have no covariates and you would thus not
expect the prediction to vary over the data. For this reason, for speed I
also restrict the calculation to take place only in the first observation --
the predicted median would be same over all observations.
--Bobby
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/