1
$\begingroup$

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.$$

$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$ Dec 12, 2012 at 16:27

1 Answer 1

1
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.