Logistic Regression Exam Questions
Logistic Regression Exam Questions
The primary difference between logistic regression and linear regression is the nature of the dependent variable. Logistic regression is used when the dependent variable is categorical, such as binary classification problems (e.g., 'Good' or 'Not Good'), while linear regression is applied to continuous dependent variables, such as predicting the price of a commodity. This difference affects their application in predictive modeling, as logistic regression models probabilities of categorical outcomes using a logistic function, whereas linear regression predicts continuous outcomes directly by minimizing the sum of squared errors .
Not preprocessing data, such as avoiding scaling or splitting data into training and test sets, can significantly impact logistic regression model outcomes. Without scaling, models may be biased towards features with larger numeric ranges, potentially skewing coefficient interactions. Omitting data splitting can lead to overfitting, where the model learns the noise in the data rather than the underlying pattern, resulting in poor generalization to new data. These practices can mislead model accuracy and performance assessments .
The accuracy of a logistic regression model is calculated by the formula: Accuracy = (TP + TN) / (TP + TN + FP + FN), where TP is true positives, TN is true negatives, FP is false positives, and FN is false negatives. In the example provided, the accuracy was calculated as (2300 + 820) / (2300 + 180 + 200 + 820) = 0.89 .
In logistic regression, the log-odds of an event being zero corresponds to a probability of 0.5 for that event. This is derived from the logistic model equation ln(P/(1-P)) = 0, where P is the probability of the event. Setting ln(1) = 0, we solve the equation for P, leading to P = 1-P. Solving the equation P + P = 1 results in P = 0.5, indicating equal odds between the occurrence and non-occurrence of the event .
For a 50-year-old non-smoker, the logistic regression model equation is derived as follows: log-odds = -8.5 + 0.2*50 + 0.15*0 = 1.5. Consequently, the probability Pr(Y = 1) is calculated by applying the logistic function: exp(1.5) / (1 + exp(1.5)) = 0.8175, indicating an 81.75% probability of the heart attack being fatal .
The intercept value in a logistic regression model does not directly indicate overall model performance, but it establishes the baseline odds when all predictor variables are set to zero. A document example asks if the intercept is greater than 1 without preprocessing, emphasizing that its magnitude alone doesn't evaluate model performance; instead, it sets the starting point for adjustments based on the predictor weights .
Following dataset-specific instructions, such as dropping certain variables or avoiding data scaling, is crucial in logistic regression to ensure the integrity of the model and the validity of its evaluations. These steps can impact model accuracy by reducing multicollinearity or preserving the natural scale of predictors, which can influence the interpretation and performance of the model. Consequently, adhering to preprocessing guidelines helps in maintaining model robustness and reliability .
The Receiver Operator Characteristic (ROC) curve plots the False Positive Rate on the X-axis and the True Positive Rate on the Y-axis. These components help evaluate a model's performance by illustrating the trade-off between sensitivity (True Positive Rate) and specificity (1 - False Positive Rate) across different threshold levels, allowing one to assess the model's ability to discriminate between the positive and the negative class .
In a confusion matrix, true positives (TP) are identified by examining the count where both the actual value and the predicted value are positive. For instance, in the given confusion matrix, the value at index location [1, 1] represents the true positives. This identification is significant as it directly relates to the model's sensitivity, affecting the understanding of how well the model predicts the positive class compared to all actually positive instances .
The Area Under the Curve (AUC) score is determined by plotting the True Positive Rate against the False Positive Rate at different threshold values without preprocessing the model. An AUC score quantifies the overall ability of the model to discriminate between the positive and negative classes, with a higher score indicating better discriminative power. For instance, an AUC of 0.852 implies that the model has substantial discriminative ability .




