How does plotslice used to analyze generalized linear models generate simultaneous confidence bounds?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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?
0 Commenti
Risposta accettata
Tom Lane
il 8 Apr 2014
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')))
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!