1
$\begingroup$

I have a binary classification problem with unbalanced classes, e.g. I have 500 examples of negative class(0) and 20 examples of positive class (1) and I need to estimate the probability of positive class. I use logistic regression, which gives me extremely small probabilities so that optimal threshold by some criteria based on ROC is about 0.1. Is there any way to force (scale) this to be 0.5 or any other arbitrary number? Thank you very much!

$\endgroup$
2
  • 2
    $\begingroup$ Is this really a classification problem? Or is it the task of estimating risk? For the latter you may not need a threshold. In general a threshold is needed only if a decision is needed automatically and instantaneously, and utilities are not considered. $\endgroup$ – Frank Harrell Oct 21 '14 at 21:26
  • $\begingroup$ Yes, thank you! It's a risk estimation problem (I've edited my question) $\endgroup$ – user2575760 Oct 21 '14 at 21:59
3
$\begingroup$

The intercept in a logistic regression model is the log odds of a "success" when all the predictor variables are at 0. This means that changing the intercept will change the "baseline" probability for a "success". One way to do this is to center your predictor variables around a meaningful value (the value at which you want to set the probability) then fit the model using the centered predictors. Change the intercept to the log odds of a success that you are interested in (0 for p=0.5). If you want the model to be back on the original scale (not centered), then it is just algebra to work out the correct intercept.

Just be careful interpreting/using/sharing this model.

Another option for classification is to use Linear Discriminant Analysis (lda) which under certain assumptions is very similar to logistic regression. The lda function in the MASS package has an argument for specifying a prior probability of class membership. This may be a more straight forward way of accomplishing what you are trying to do.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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