0
$\begingroup$

I am looking at how pavement thickness variation parameters(absolute thickness, variance, slopes, critical points) relate to distress occurrence.

After some research, I have settled on the linear logistic model for regression testing. In order to get distress rates (pHat), I bin my binary data data using MATLAB's binning algorithm and then use the following function to fit a logistic linear model:

function[pihat] = fitRegression(X,Y)
    %X = [n x 1] array of predictor variable
    %Y = [n x 1] logical array of distress occurrence

    [N,edges,bin] = histcounts(X); %use MATLAB automatic binning algorithm
    X = (edges(1:end-1) + edges(2:end))/2; % get mean bin values for regression fitting.
    bin = bin(bin~=0); %remove 0 data        
    for i = 1:length(N)
        pihat(i) = sum(Y(bin==i))./N(i); % calculate pihat for each bin
    end

    Y = pihat;
    glm = GeneralizedLinearModel.fit(X,Y,'distr','binomial', 'link', 'logit');
    logitFit = glmval(glm.Coefficients.Estimate,linspace(floor(min(X)),ceil(max(X)),numel(X)),'logit');

    ps = plotSlice(glm);
end

Is my binning and use of a logit GLM valid?

$\endgroup$
  • $\begingroup$ Why do you bin the data ? If I understand your code (I don't know mathlab) you have an explanatory variable $X$ and a dependent variable $Y$ where $Y$ is binary, so you can do logistic regression without binning ? or is $X$ categorical ? if $X$ is categorical, then binning should make no difference compared to using the binary $Y$ as an dependent. $\endgroup$ – user83346 Sep 18 '15 at 6:21
  • $\begingroup$ You are correct, I do bin X. I originally thought that logistic regression needed Y to be a pHat. I have come across a new method (also in MATLAB) that does not require binning. I will post when completed. $\endgroup$ – rconway91 Sep 18 '15 at 20:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.