Questions tagged [logistic-regression]

Logistic regression is a statistical classification model used for making categorical predictions.

Logistic regression is a statistical analysis method used for predicting and understanding categorical dependent variables (e.g., true/false, or multinomial outcomes) based on one or more independent variables (e.g., predictors, features, or attributes). The probabilities describing the possible outcomes of a single trial are modeled as a function of the predictors using a logistic function (as it follows):

enter image description here

A logistic regression model can be represented by:

enter image description here

The logistic regression model has the nice property that the exponentiated regression coefficients can be interpreted as odds ratios associated with a one unit increase in the predictor.

Multinomial logistic regression (i.e., with three or more possible outcomes) are also sometimes called Maximum Entropy (MaxEnt) classifiers in the machine learning literature.


Tag usage

Questions on should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

3746 questions
6
votes
1 answer

Logistic regression + histogram with ggplot2

I have some binary data, and I want to plot both a logistic regression line and the histogram of relative frequencies of 0s and 1s in the same plot. I ran into a very nice implementation using the package popbio here: shizuka lab's page Here a MWE…
PaoloCrosetto
  • 600
  • 1
  • 7
  • 16
6
votes
2 answers

Bootstrap Multinomial regression in R

I am trying to bootstrap a simple multinomial regression in R, and I am getting an error: Error in is.data.frame(data) : object 'd' not found What is really strange is that I am using the same code (adjusted to this particular problem) as in a…
striatum
  • 1,428
  • 3
  • 14
  • 31
6
votes
1 answer

Logistic Regression with sklearn

Not sure if this is a great place for this question, but I was told CrossValidated was not. So, all these questions refer to sklearn, but if you have insights into logistic regression in general, I'd love to hear them as well. 1) Does data have to…
Baron Yugovich
  • 3,843
  • 12
  • 48
  • 76
6
votes
1 answer

Online logistic regression model

I have seen wolfram and other few websites which claim that every time we use object detection application and label it with the correct object the image represents, their algorithm uses the data to update their object detection model. I am working…
6
votes
1 answer

Role of class_weight in loss functions for linearSVC and LogisticRegression

I am trying to figure out what exactly the loss function formula is and how I can manually calculate it when class_weight='auto' in case of svm.svc, svm.linearSVC and linear_model.LogisticRegression. For balanced data, say you have a trained…
JRun
  • 669
  • 1
  • 10
  • 17
6
votes
1 answer

how to get probabilities between 0 and 1 using glmnet logistic regression

consider the following example rm(list = ls(all=T)) library(ISLR) library(glmnet) Hitters=na.omit(Hitters) # Binary proble - Logistic regression Hitters$Salary <- ifelse(Hitters$Salary > 1000, 1, 0) Hitters$Salary <- as.factor(Hitters$Salary) #…
marbel
  • 7,560
  • 6
  • 49
  • 68
6
votes
4 answers

How to run a robit model in Stan?

I would like to run a robust logistic regression (robit) in Stan. The model is suggested in Gelman & Hill's "Data Analysis Using Regression and Multilevel Methods" (2006, pp. 124), but I'm not sure how to implement it. I checked Stan's Github…
danilofreire
  • 503
  • 1
  • 5
  • 18
6
votes
1 answer

Multinomial logit models and nested logit models

I am using the mlogit package in program R. I have converted my data from its original wide format to long format. Here is a sample of the converted data.frame which I refer to as 'long_perp'. All of the independent variables are individual…
marcellt
  • 501
  • 5
  • 14
6
votes
1 answer

No zeros predicted from zeroinfl object in R?

I created a zero inflated negative binomial model and want to investigate how many of the zeros were partitioned out to sampling or structural zeros. How do I implement this in R. The example code on the zeroinfl page is not clear to…
marcellt
  • 501
  • 5
  • 14
6
votes
2 answers

Struggling with BFGS minimization algorithm for Logistic regression in Clojure with Incanter

I'm trying to implement a simple logistic regression example in Clojure using the Incanter data analysis library. I've successfully coded the Sigmoid and Cost functions, but Incanter's BFGS minimization function seems to be causing me quite some…
5
votes
2 answers

sklearn logistic regression loss value during training

Is there a way to obtain loss value at each iteration while training a logistic regression? Python sklearn show loss values during training has an working example for SGDRegressor however not working for logistic regression.
haneulkim
  • 4,406
  • 9
  • 38
  • 80
5
votes
2 answers

class_weight = 'balanced' equivalent for naive bayes

I'm performing some (binary)text classification with two different classifiers on the same unbalanced data. i want to compare the results of the two classifiers. When using sklearns logistic regression, I have the option of setting the class_weight…
dumbchild
  • 275
  • 4
  • 11
5
votes
1 answer

AttributeError: 'str' object has no attribute 'decode' while building a logistic regression model

I am trying to build a logistic regression model but it shows an AttributeError: 'str' object has no attribute 'decode'. please help me fix this. This code ran perfectly on Datacamp's server but its showing an AttributeError on my Laptop. import…
Bickky Sahani
  • 351
  • 4
  • 13
5
votes
1 answer

Remove linear dependent variables while using the bife package

Some pre-programmed models automatically remove linear dependent variables in their regression output (e.g. lm()) in R. With the bife package, this does not seem to be possible. As stated in the package description in CRAN on page 5: If bife does…
John Doe
  • 212
  • 1
  • 9
  • 28
5
votes
1 answer

Logistic glmer{lme4} model isSingular despite being very simple

I'm trying to run a relatively straightforward glmer model and get warnings that it isSingular and I can't figure out why. In my dataset, 40 participants did 108 trials. They responded to a question (the response is coded as correct/incorrect - 0/1)…
elisa
  • 965
  • 9
  • 27