How does plotslice used to analyze generalized linear models generate simultaneous confidence bounds?

5 ビュー (過去 30 日間)
Plotslice tool from the statistics toolbox creates a figure containing a series of plots, each representing a slice through the regression surface predicted by the model. In case of multiple predictor variables, there is an effect of the choice of predictor variables that change the confidence bounds.
From the function coefsCI i can generate the confidence intervel of the coefficients of the model. In my case i am using a logistic model with 5 parameters and 2 interactions. I find that the surface i generate with the aid of the coefsCI are too wide compared to the bounds generated by plot slice. So wide that the the lower bound of probability stays zero where as the upper bound is 1.
Is there any difference in the method that is used to calculate the bounds in case of plotslice?

採用された回答

Tom Lane
Tom Lane 2014 年 4 月 8 日
I'm not sure how you are comparing intervals from coefCI, which are for the coefficients, and intervals from plotSlice, which are for predictions.
The plotSlice function just computes predictions and confidence bounds for them. Here are some examples of how to reproduce those same things by hand. Remember to invert the logistic function when you compute predictions.
% example from "help fitglm"
load hospital
formula = 'Smoker ~ Age*Weight*Sex - Age:Weight:Sex';
glm = fitglm(hospital,formula,'distr','binomial');
% Get predictions and confidence intervals
[pred,ci] = predict(glm,hospital(1,:))
% calculate those by hand
b = glm.Coefficients.Estimate;
C = glm.CoefficientCovariance;
x = [1 1 38 176 38 176 38*176]; % from first row of hospital data
mypred = 1./(1+exp(-x*b))
myci = 1./(1+exp(-x*b + [1 -1] * 1.96*sqrt(x*C*x')))
% compute the plotslice default (simultaneous) intervals by hand
simci = 1./(1+exp(-x*b + [1 -1] * sqrt(chi2inv(.95,7))*sqrt(x*C*x')))
  1 件のコメント
varun
varun 2014 年 4 月 8 日
Thanks for the reply Tom. In your quoted example, for calculating myci I was using the coefficents evaluated from from coefCI.
My assumption is that the coefCI returns the values of the coefficients by plugging which i can get the confidence interval of the predictor variable.
However, there seems to be a fallacy in my assumption. As when i plugin the coefficients from coefCI the returned value is either 0 or 1 for the predicted variable
My code for this would look like
myci = 1./(1+exp(-x*coefCI(glm)))
myci= 0 1
which doesnt make any sense.
Also could you point me to why there is a difference in the values of myci and simci as you are still using the 95 % confidence interval value right ? Shouldnt the function chi2inv return 1.96 or is it a function of the number of degrees of freedom?
If you can point me to some resource that would help me understand the difference in between simultaneous confidence interval and the regular one i would greatly appreciate it.
Thank you for your effort in helping me.
Varun

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by