100% found this document useful (3 votes)
937 views5 pages

Logistic Regression Exam Questions

The document contains questions and answers related to logistic regression. It discusses that logistic regression is used for classification problems when the dependent variable is categorical. Linear regression is used when the dependent variable is continuous. It also provides the accuracy, true positives, intercept value, and AUC score of a logistic regression model built on a prisoner recidivism dataset without preprocessing.

Uploaded by

sonali Pradhan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
937 views5 pages

Logistic Regression Exam Questions

The document contains questions and answers related to logistic regression. It discusses that logistic regression is used for classification problems when the dependent variable is categorical. Linear regression is used when the dependent variable is continuous. It also provides the accuracy, true positives, intercept value, and AUC score of a logistic regression model built on a prisoner recidivism dataset without preprocessing.

Uploaded by

sonali Pradhan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
  • Logistic Regression - Exercise 1
  • Logistic Regression - Exercise 2
  • Logistic Regression - Exercise 3
  • Logistic Regression - Exercise 5
  • Logistic Regression - Exercise 4

Q No: 

Correct Answer
Marks: 1/1

Logistic Regression is applied when the Dependent Variable is of Continuous nature.

Select True or False.

True

False
You Selected

Logistic Regression is used for classification problems, i.e. when the dependent variable is of
Categorical Nature. For Example, Good or Not Good, Guilty or Not Guilty, Defaulter or Not a
defaulter etc.

On the contrary, when you are trying to predict a Continuous Variable, you can choose to use
Linear Regression. For example, Price of a commodity, Run Rate of a Batsman etc.

Q No: 2

Correct Answer
Marks: 1/1

If ln(odds) of an event is 0, what is the probability of that event?

Note: 'ln' refers to the natural logarithm (i.e. logarithm to the base  )

0.5
You Selected
1

None of the mentioned.

Follows from the definition.

In this case, we know that ln(P/(1-P) = 0. So, for the equation to be 0 we need to have P = 1-P (as
ln(1) = 0). Thus, we can say that P=1-P=0.5.

Q No: 3

Correct Answer
Marks: 1/1

The following table shows the cross-tabulation of actual and predicted response after a logistic
regression model fit. What is the accuracy of the logistic regression?

 
  Actual Good Actual Bad

Predicted Good 2300 180

Predicted Bad 200 820

0.11

0.82

0.89
You Selected
0.92

Accuracy = (TP+TN)/ (TP+TN+FP+FN)

Accuracy = (2300+820)/(2300+180+200+820) = 0.89

Q No: 4

Correct Answer
Marks: 1/1
What do we plot (in the X-axis and the Y-axis) in the Receiver Operator Characteristic (ROC)
curve?

X-axis : False Positive Rate, Y-axis : True Positive Rate


You Selected
X-axis : True Positive Rate, Y-axis : False Positive Rate

X-axis : Accuracy, Y-axis : Misclassification Rate

X-axis : False Negative Rate, Y-axis : True Negative Rate


Q No: 5

Correct Answer
Marks: 1/1

To predict whether a heart attack is fatal, logistic regression is fitted. Y = 1, if the attack is fatal, 0
otherwise. The following model is found to be adequate

 = -8.5 + 0.2*Age + 0.15*Smoking Status [here 'ln' stands for natural


logarithm (i.e. logarithm to the base  )]

Where Smoking Status = 1 if the person is a current smoker and 0 otherwise. Find the percentage
probability that a 50-year-old non-smoker will have a fatal attack.
84.2%

81.75%
You Selected
82.34%

89.71%

Putting the required value in the log-odds equation we get:

 = -8.5 + 0.2*(50) + 0.15*(0) = 1.5

Pr(Y = 1) = exp(1.5)/(1+exp(1.5)) = 0.8175

Q No: 6

Correct Answer
Marks: 1.50/1.50

To answer the question, please follow the instructions given below:

 Use the given dataset 


 Drop the "Prisoner Ids" Variable
 Do not scale the data
 Do not split the data into training and test.

Build a Logistic Regression Model on the data set.


What is the value of the accuracy score on the data?

Note: Please do not pre-process the data in any way before fitting the logistic regression model.

0.85625

0.78256

0.8411
You Selected
0.7921
Q No: 7

Correct Answer
Marks: 1.50/1.50

To answer the question, please follow the instructions given below:

 Use the given dataset 


 Drop the "Prisoner Ids" Variable
 Do not scale the data
 Do not split the data into training and test.
Build a Logistic Regression Model on the data set.

What is the value of the True Positives predictions based on the confusion matrix?

Note: For this question, use the whole data to build the model, then use the independent
variables to predict the same whole data and then build a confusion matrix.

Note: Please do not pre-process the data in any way before fitting the logistic regression model.

480
You Selected
674

140

78
In python, when you print the confusion matrix it is understood like this:

0 1
0 674 140
1 78 480

 0,1 represents the class predicted. 0 comes first.

True Positive is when the actual class is 1 and the model predicted it to be 1 as well. Thus, for
index location [1,1] is the true positive in the given confusion matrix i.e. 480.

Try this code from


documentation: [Link]
[Link] to an external site.
tn, fp, fn, tp = metrics.confusion_matrix(actuals,predicted).ravel()
print('Number of True Positives is ',tp)

Output: # of True Positives is 480

Q No: 8

Correct Answer
Marks: 1/1

To answer the question, please follow the instructions given below:

 Use the given dataset 


 Drop the "Prisoner Ids" Variable
 Do not scale the data
 Do not split the data into training and test.

Build a Logistic Regression Model on the full data set.

Select True or False for the following statement.


The value of the intercept of the model is greater than 1.

Note: Please do not pre-process the data in any way before fitting the logistic regression model.

True

False
You Selected
Q No: 9

Correct Answer
Marks: 1/1

To answer the question, please follow the instructions given below:

 Use the given dataset 


 Drop the "Prisoner Ids" Variable
 Do not scale the data
 Do not split the data into training and test.

Build a Logistic Regression Model on the data set

Obtain the predictions for the data set.

What is the Area Under the Curve Score on the Data?

Note: Please do not pre-process the data in any way before fitting the logistic regression model.

0.852
You Selected
0.72

0.67

0.50

Common questions

Powered by AI

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 .

Q No: 1
Correct Answer
Marks: 1/1
Logistic Regression is applied when the Dependent Variable is of Continuous nature.
Select
 
Actual Good
Actual Bad
Predicted Good
2300
180
Predicted Bad
200
820
 
0.11
0.82
0.89
You Selected
0.92
Accuracy = (TP+TN)/
84.2%
81.75%
You Selected
82.34%
89.71%
Putting the required value in the log-odds equation we get:
 = -8.5 + 0.2*(50) + 0.15
Build  (https://olympus.mygreatlearning.com/courses/64452/files/5101788/download?verifier=VoourpPfDydkzmZHHpJsKVZMOvQqh3ub06N
The  (https://olympus.mygreatlearning.com/courses/64452/files/5101788/download?verifier=VoourpPfDydkzmZHHpJsKVZMOvQqh3ub06Nx7

You might also like