I'm running a predictive model to predict the probability of winning a certain item based on the price that I bid (other factors also). After running the model (ols) in R, I wanted to account for all the variables in my model and develop a graph highlighting the 'predicted probabilities' regarding the primary variables I'm concerned about. So want to have a line graph showing the probability of winning on the y axis, and the bid on the x axis. The following data would result in a graph which shows that the probability of winning decreases as the bid increases.

Bid                  8  6      4
Probability Winning 30% 22%    18%
  1. Are predicted probabilities only relevant for logistic regression models or can be equally relevant for linear regression models?
  2. What is the reasoning and logic behind going from a model to a probability curve which would show the 'trend' in one variable as predicted by another, while accounting for all other factors.

Sorry for the elementary question, I'm just a little clueless. Thanks for the help!


1 Answer 1


First, there are times when you could get away with fitting an ordinary least squares linear regression to a response variable which is 0 or 1 (which is what I presume you have). This would include for example when the probability never gets very close to zero or one. But why would you do this if you have R? You should fit a logistic regression model instead, using glm() and family=binomial.

Putting that aside, whichever model you have it is certainly a good thing to plot the predicted values of the response against each of your explanatory variables while holding the other explanatory variables at their average values. This is an excellent way of visualising the results from this sort of model.

The reasoning and logic should follow from the fact that your response variable in your model (whether OLS or logistic) should be a column of zeroes and ones. So you need to look at the predicted values from your model, which should be somewhere between zero and one and can be interpreted as the probability at that particular point. This is one reason not to use OLS - as the predicted values can be negative or higher than one, which isn't possible with a logistic regression.

Here is some R code with simulated data:

y <- sample(c(0,1), 1000, replace=T)
x1 <- rnorm(1000)
x2 <- rnorm(1000)
model <- glm(y ~ x1 + x2, family=binomial)
x1a <-seq(min(x1),max(x1),length.out=100)
x2a <-seq(min(x2),max(x2),length.out=100)
plot(x1a, predict(model, newdata=data.frame(x1=x1a, x2=rep(mean(x2),100)), 
    type="response"),   type="l", ylab="Predicted probability", 
    main="Effect of x1 at average value of x2")
plot(x2a, predict(model, newdata=data.frame(x1=rep(mean(x1),100), 
    x2=x2a), type="response"),  ylab="Predicted probability", 
    main="Effect of x2 at average value of x1", type="l")

As an aside, unless the things you are bidding for are all similar in value, you may find that your model doesn't work very well. eg I can bid $100 for a car and fail but $10 for a postage stamp and win every time... You would need I suppose to somehow scale your bid to the "true" value - finding some way to do this that does not depend on the final winning bid.


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.