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
1
vote
1 answer

numpy inverse matrix not working for full rank matrix - hessian in logistic regression using newtons-method

I am trying to compute the inverse of a full-rank matrix using numpy, but when I test the dot product, I find that it does not result in the identity matrix - which means it did not invert properly. My code: H = calculateLogisticHessian(theta, X)…
1
vote
1 answer

Inconsistent results between glm() in R and manual implementation of logistic regression in Excel

You'll find a manual implementation of logistic regression in Excel at: http://blog.excelmasterseries.com/2014/06/logistic-regression-performed-in-excel.html. This implementation uses the dataset below and reports the following coefficients b0 =…
majom
  • 7,863
  • 7
  • 55
  • 88
1
vote
1 answer

R logistic regression model.matrix

I am new to R and I am trying to understand the solution of a logistic regression. All that is done so far is to remove unused variables, split the data into train and test datasets. I am trying t understand part of it where it talks about…
lakshru
  • 41
  • 1
  • 1
  • 5
1
vote
1 answer

Manual LOOCV vs cv.glm

In Introduction to Statistical Learning we're asked to do the Leave Out One Cross Validation over logistic regression manually. The code for it is here: count = rep(0, dim(Weekly)[1]) for (i in 1:(dim(Weekly)[1])) { ##fitting a logistic regression…
Mooncrater
  • 4,146
  • 4
  • 33
  • 62
1
vote
1 answer

PROC GENMOD Error: Nesting of continuous variable not allowed

I am doing cross-sectional logistic regression modeling of the probability of an event in eyes. Each patient is assigned an PatientID and each eye is assigned an EyeID; there are 2 eyes per patient. I have attached my code blow. PROC GENMOD…
ybao
  • 147
  • 8
1
vote
2 answers

Logistic regression: how to try every combination of predictors in R?

This is a duplicate of https://stats.stackexchange.com/questions/293988/logistic-regression-how-to-try-every-combination-of-predictors. I want to perform a logistic regression: I have 1 dependent variable and ~10 predictors. I want to perform an…
user8202504
1
vote
1 answer

PySpark: LogisticRegressionWithLBFGS is getting slower in iteration

I have an iteration which calls LogisticRegressionWithLBFGS x times. The problem is, that the iteration is getting slower every loop and finally hangs forever. I tried a lot of different approaches, but no luck so far. The code looks like that: def…
1
vote
0 answers

Binary logistic regression with a dichotomous predictor

I'm getting puzzled by a binary logistic regression in R with (obviously) a dichotomous outcome variable (coded 0 and 1) and a dichotomous predictor variable (coded 0 and 1). A contingency table suggests the outcome is a very good predictor, but…
IanW
  • 301
  • 1
  • 2
  • 4
1
vote
1 answer

Locally weighted smoothing for binary valued random variable

I have a random variable as follows: f(x) = 1 with probability g(x) f(x) = 0 with probability 1-g(x) where 0 < g(x) < 1. Assume g(x) = x. Let's say I am observing this variable without knowing the function g and obtained 100 samples as…
1
vote
1 answer

Python: Logistic Regression gives ValueError: Unknown label type: 'continuous'

I have a question related to Logistic Regression where I am getting ValueError Here's my dataset: sub1 sub2 sub3 sub4 pol_1 0.000000 0.000000 0.0 0.000000 pol_2 0.000000 …
1
vote
0 answers

How do I plot predicted probabilities for a Logit regression with fixed effects in R?

I am a complete newbie to R. I have the following logit equation I am estimating: allAM <- glm (AM ~ VS + Prom + LS_Exp + Sex + Age + Age2 + Jpart + X2004LS + X2009LS + X2014LS + factor(State), family = binomial(link = "logit"), data = mydata) AM…
1
vote
0 answers

How to get the p value for RERI in additive interaction model (logistic regression)?

I'm doing an biological interaction analysis from logistic regression, and apply it to additive model, as suggested by Hosmer and Lemeshow (1992). But I learnt the code from the epi.interaction function | R Documentation. It tells only the…
Tyelcie
  • 48
  • 5
1
vote
0 answers

Proc logistic to get asymmetric binary model results

I am doing predictive analytics in SAS using proc logistic to predict a binary outcome to guide decision making. One measure of accuracy is the misclassification rate, but in my case the desired model is asymmetric in the sense that a false…
Rob_in_WI
  • 11
  • 1
1
vote
1 answer

Unable to perform logistic regression in R

I am trying out logistic regression on a data.frame (11359 rows, 137 columns). The data.frame contains Y (one dependent variable) and the predictors (136 independent variables). All the variables are binary. The formula I created based on "my_data"…
elpavlos
  • 35
  • 4
1
vote
1 answer

ROCR does not plot standard errors

I am trying to plot a ROC curve with standard deviation using the the ROCR package. I am using the quality.csv file for a reproducible example to be found here --…
rf7
  • 1,993
  • 4
  • 21
  • 35
1 2 3
99
100