# Implementing a Logit Model With Multiple Predictors

Let's say I have the following equation:

Won = B0 + B1*(Bid)


Once I know B0 and B1, I can generate the probability curve and find the probability of "won" for each "bid."

However, let's say I add a variable zipcode, and add it to the logit model. In R, I save it as a factor and end up with:

Won = B0 + B1*(Bid) + B2*(zip5001-6000) + B3*(zip6001-7000) + B4*(zip7001-8000)


Once I find all the coefficients, I want to find the probability curve for each zipcode, such that I can say, "when the bid is x and the zipcode is y, the probability of winning is f." What I assumed is that for B2, I would take:

Won = B0 + B1*(Bid) + B2*(zip5001-6000) + 1*(zip6001-7000) + 1*(zip7001-8000)


However, this doesn't give me the probability of "won" when bid is x and B2 is 5001-6000.

I'm doing this by adding the coefficients to the general equation for the probability curve.

How would I be able to generate a curve for the desired probabilities and how should the equation look?

The probability equation I am using is =

$$\text{Prob} = \frac{1}{1 + e^{-z}}$$

where

$$z = B_0 + B_1X_1 + \dots + B_nX_n.$$

• Where were you going with terms like zip5001-6000? That seems like a kind of centering you might do for a continuous covariate, but not for a factor. Commented Dec 12, 2012 at 16:27

If zipcode is a factor in R, i.e., is.factor(zipcode) returns TRUE, then it's enough to enter it as a variable once, i.e., B2(zipcode) will automatically figure out a separate "effect" (coefficient) for each level (value) that zipcode can take. For example, you could fit that model as a logistic regression as glm(won ~ bid + zipcode, mydata). glm() will automatically add an intercept b0. Once you fit the model, you'll find the coefficients that you can plug into your probability equation.