recreate confidence bounds for logistic regression in plotSlice

I am generating and analyzing logisitic regression models using fitglm. http://www.mathworks.com/help/stats/fitglm.html The fit models can then be visualized using plotSlice(glm). This figure is great, but is hard to customize.
I want to recreate the confidence bounds from plotSlice, but I am unable to reproduce them. No where in documentation or figure can find the confidence bound data or the equation used to calculate it.
I have tried to recreate the bounds by calculating the variance of the sums of the fit coefficients as instructed in Wiley Series in Probability and Statistics : Applied Logistic Regression (3rd Edition)
Ex (1 parameter(B1) with intercept(B0)).
Var(g(xi)) = var(B0)+xi^2(var(B1))+2*(covar(B0,B1)) %the variance of the model at xi
where B0 is the fit intercept, B1 is the fit slope;
g_CI = +- z*sqrt(Var(g(xi)))% bounds at xi
where z is the z score from standard normal dist.
in MATLAB:
if true
mdlCoeff = [-1.2631;0.1558];
stats.se = [0.4472;0.0641];
stats.covb = [0.2000,-0.0271;-0.0271,0.0041];
testX = 7;
testp = mdlCoeff(1) + mdlCoeff(2)*testX;
phattest = exp(testp)./(1 + exp(testp));
varXitest = (stats.se(1).^2)+((testX.^2).*stats.se(2).^2)+(2*testX.*stats.covb(3));
phat_bounds3test = [phattest + (normcdf(.975).*(varXitest.^0.5)),phattest - (normcdf(.975).*(varXitest.^0.5))]
end
% this gives me 95% bounds of 0.5896 and 0.3333
However, the plotSlice produce figure returns .5467 and .3700. Even when I reduce my intervals in 0 I don't get this narrow of a bound. Therefore I must be calculating varXitest incorrectly.
What am I missing here?

Answers (0)

Asked:

on 7 Nov 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!