Hello,
I estimated the logit model, but I need to plot the distribution (PDF) underlying the logit model. Could you please provide some help on this?
Thanks!
1 Answer
0
Hello,
If I am interpreting your question correctly you want to be able to graph the underlying logistic function y = e^(b0+xb)/(1+e^(b0 + xb)). I am not sure how you have estimated your logit model but I can provide a general explanation. Suppose we have estimated the logit model of the dependent variable, y, on the dependent variable, x. The model yields two estimates, an intercept, b0 and a coefficient, b. In order to create your graph, you need to first generate y_pred = b0 + xb. However, for the sake of the graph, the y_pred should be created using a sorted x.
x_sorted = sortc(x,1);
y_pred = b0 + x_sorted.*b;
Next, y_pred needs to be transformed logistically:
y_gr = exp(y_pred)./(1+ exp(y_pred));
This can now be directly graphed using the plotXY function.
plotXY(x_sorted, y_gr);
If you provide more information regarding how you estimated the logit model or provide code, I would be happy to provide a more detailed and specific explanation.
Your Answer
1 Answer
Hello,
If I am interpreting your question correctly you want to be able to graph the underlying logistic function y = e^(b0+xb)/(1+e^(b0 + xb)). I am not sure how you have estimated your logit model but I can provide a general explanation. Suppose we have estimated the logit model of the dependent variable, y, on the dependent variable, x. The model yields two estimates, an intercept, b0 and a coefficient, b. In order to create your graph, you need to first generate y_pred = b0 + xb. However, for the sake of the graph, the y_pred should be created using a sorted x.
x_sorted = sortc(x,1);
y_pred = b0 + x_sorted.*b;
Next, y_pred needs to be transformed logistically:
y_gr = exp(y_pred)./(1+ exp(y_pred));
This can now be directly graphed using the plotXY function.
plotXY(x_sorted, y_gr);
If you provide more information regarding how you estimated the logit model or provide code, I would be happy to provide a more detailed and specific explanation.