I am using Stata 14 to fit a logistic model (via melogit) and I am getting confidence intervals below 0 and above 1 when I predict probabilities using the margins command, as discussed in this thread.
These impossible (or rather, wrongly scaled) values seem to obtain because Stata uses the delta method to estimate the standard errors of the predicted probabilities and generates the CIs from that standard error instead of estimating the standard errors from the log odds and generating the CIs from them (as discussed here).
My question are:
(a) Is it possible to obtain "correct" CIs based on the lower and upper bounds of a 95% confidence interval for the linear prediction that are then converted into "correct" probabilities, for example using the transform_margins command provided by Jeff Pitblado (see first thread linked above)?
I use
to obtain linear predictions of the fixed model component and then
to obtain CIs based on the transformed marginal linear prediction.
These CIs now range from 0-1, unlike the CIs for the predicted probabilities that can be obtained from margins itself, e.g. like so:
Are the CIs obained through this application of transform_margins indeed "correct" (in the sense of the FAQ linked above)?
(b) Is there a way to plot the "correct" CIs for predicted marginal probabilities after melogit or any other GLM command (ranging from 0-1), using the marginsplot command or some workaround? The simple
obviously does not plot results obtained from transform_margins.
Thanks,
Eike
These impossible (or rather, wrongly scaled) values seem to obtain because Stata uses the delta method to estimate the standard errors of the predicted probabilities and generates the CIs from that standard error instead of estimating the standard errors from the log odds and generating the CIs from them (as discussed here).
My question are:
(a) Is it possible to obtain "correct" CIs based on the lower and upper bounds of a 95% confidence interval for the linear prediction that are then converted into "correct" probabilities, for example using the transform_margins command provided by Jeff Pitblado (see first thread linked above)?
I use
Code:
margins, at(X=(1(1)100)) predict(xb fixedonly)
Code:
transform_margins invlogit(@)
These CIs now range from 0-1, unlike the CIs for the predicted probabilities that can be obtained from margins itself, e.g. like so:
Code:
margins, at(X=(1(1)100)) predict(mu fixedonly)
(b) Is there a way to plot the "correct" CIs for predicted marginal probabilities after melogit or any other GLM command (ranging from 0-1), using the marginsplot command or some workaround? The simple
Code:
marginsplot, recastci(rarea) recast(line)
Thanks,
Eike
Comment