












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!













49 exam-style multiple-choice questions. Each question includes the correct answer and a complete rationale for focused revision.
This exam assesses graduate-level competency in logistic regression analysis, including data preparation, Python modeling with statsmodels and scikit-learn, model interpretation, confusion matrix evaluation, and results reporting. It emphasizes practical application, reproducibility, and critical evaluation of classification models.
Recommended duration: 3 hours. Passing target: 80%.
1. In the D600 Task 2 analysis, which statement best justifies the research question's
business relevance?
CORRECT: A. The research question explores how housing features predict luxury classification to inform pricing and investment decisions. The research question in the report explicitly addresses predicting luxury classification from housing features for business decision-making. Option B is incorrect because the analysis uses logistic regression, not linear regression. Option C is incorrect as the method is supervised classification, not clustering. Option D is not mentioned in the report.
2. Which of the following best describes the purpose of the descriptive statistics
computed in Section C2?
CORRECT: A. To summarize the distribution and central tendency of variables, aiding in understanding data characteristics and guiding modeling decisions. Descriptive statistics provide summary measures like mean, standard deviation, and quartiles to understand data distribution and balance. Option B is incorrect because significance testing occurs during model fitting. Option C refers to encoding, not descriptive statistics. Option D relates to model evaluation, not descriptive statistics.
3. In the D600 Task 2 report, the dataset was split into training (75%) and test (25%) sets.
Which scikit-learn function is most appropriate for this split?
CORRECT: A. train_test_split The train_test_split function from scikit-learn is commonly used to split data into training and test sets. Option
7. In the confusion matrix, if the model predicts 100 luxury homes but only 80 are actually
luxury, what is the precision?
Precision = true positives / (true positives + false positives) = 80/100 = 0.80. Options B, C, D are incorrect calculations.
8. Which of the following is a key assumption of logistic regression that must be checked?
CORRECT: A. Linearity between log odds and continuous predictors. Logistic regression assumes a linear relationship between continuous predictors and the log odds of the outcome. Options B and C are assumptions of linear regression, not logistic. Option D is not a standard assumption; multicollinearity is a concern but not independence.
9. In the D600 Task 2 report, why were categorical variables like Garage and Fireplace
one-hot encoded?
CORRECT: A. To convert them into numerical format suitable for logistic regression. One-hot encoding transforms categorical variables into binary indicators for model compatibility. Option B is not the purpose; it may increase predictors. Option C is unrelated. Option D is incorrect as encoding does not normalize.
10. Which GitLab practice best ensures reproducibility and traceability in the D600 Task 2
project?
CORRECT: A. Committing after each rubric-aligned section with descriptive messages and timestamps. Frequent commits with descriptive messages and timestamps provide a clear history for reproducibility and traceability. Option B lacks granularity. Option C ignores branching best practices. Option D is insufficient without ongoing commits.
11. In the Task 2 report, backward stepwise elimination used p > 0.05. Which critique of
this threshold is most defensible?
CORRECT: A. A fixed 0.05 cutoff ignores effect size and can retain trivial predictors in large samples. With n=7,000, tiny and practically meaningless effects can yield p<0.05, so a fixed alpha conflates statistical and practical significance; effect size and confidence intervals should guide retention. Statsmodels does report logit p-values, the cutoff does not optimize test accuracy, and stepwise removal does not systematically bias only the intercept.
12. The report one-hot encoded Garage and Fireplace but left quantitative predictors
unscaled. Which consequence is most accurate for statsmodels Logit?
CORRECT: B. Coefficients remain interpretable per unit, but numerical conditioning and convergence speed may suffer. Logit is scale-equivariant: coefficients adjust to units, so interpretation per unit is preserved, but widely differing predictor scales can slow or destabilize iterative optimization. Scaling is not required for validity, does not change the optimum, and does not by itself cause separation.
13. A fitted logit gives SquareFootage coefficient 0.0008. What is the odds ratio for a
500-square-foot increase?
An OR of 1.8 means 80% higher odds, not 80% higher probability, and observational logistic regression does not establish causation. Odds ratios routinely exceed 1, risk differences are a separate estimand, and ORs apply to categorical indicators.
17. The report split 75/25 before one-hot encoding. Which leakage risk is most relevant if
encoding were fit on all data?
CORRECT: A. Test-set category levels could influence the encoded feature space, biasing evaluation. Fitting encoders (or any preprocessing) on the full dataset lets test information shape the feature representation, producing optimistic and non-reproducible evaluation. Encoding does not duplicate rows, cause separation, or selectively alter only the intercept.
18. In the Task 2 GitLab workflow, which practice best supports reproducibility of the
logistic regression results?
CORRECT: B. Committing code, environment file, and data dictionary with descriptive messages at each rubric section. Reproducibility requires code, pinned environment, and data documentation committed incrementally with traceable messages. Deferred or single 'final' commits lose traceability, and unversioned data undermines reproducibility.
19. A logit model predicts P(luxury)=0.62 for a home. Lowering the decision threshold
from 0.5 to 0.4 will most likely:
CORRECT: B. Increase recall and decrease precision. Lowering the threshold classifies more cases as positive, raising true positives (recall) while admitting more
false positives (lower precision). AUC is threshold-independent, and precision and recall generally move in opposite directions along the curve.
20. The report's research question asks which features predict IsLuxury. Which addition
most strengthens the complete written analysis?
CORRECT: A. Reporting odds ratios with 95% confidence intervals and a held-out confusion matrix. Odds ratios with confidence intervals convey direction, magnitude, and uncertainty, while a held-out confusion matrix demonstrates predictive performance-together a complete analysis. Training accuracy alone overfits, linear regression on a binary target is misspecified, and p-values alone omit effect size and predictive validity.
21. For a luxury-home logistic model, which reported metric best quantifies ranking ability
across all thresholds?
CORRECT: B. Area under the ROC curve (AUC) AUC summarizes discrimination across every possible threshold, making it threshold-independent. Accuracy at 0.5 is threshold-specific, pseudo-R² measures fit not ranking, and a coefficient p-value tests significance rather than classification performance.
22. Backward elimination in statsmodels removed BackyardSpace (p = 0.21). Which
interpretation is most defensible?
CORRECT: B. BackyardSpace lacks significant partial association given retained predictors Stepwise p-values assess each predictor's partial contribution conditional on the others, not universal irrelevance. Dropping a non-significant term is a modeling choice, not invalidation, and bivariate association does not override conditional non-significance.
CORRECT: B. It compares log-likelihoods, so values near 0.2-0.4 can indicate strong fit McFadden's pseudo-R² is 1 LL(model)/LL(null), a log-likelihood ratio with no variance-explained meaning. Binary outcomes have no continuous variance to partition, and conventional thresholds differ from OLS R².
27. A reviewer asks for reproducibility of the 75/25 split. Which practice best satisfies D
and current standards?
CORRECT: B. Set and document random_state with committed, versioned code Fixing and documenting random_state in committed code ensures identical splits and traceability. Reporting only accuracy, reseeding until favorable, or training on all data undermines reproducibility and valid evaluation.
28. The report states 3,500 luxury and 3,500 non-luxury homes. Which evaluation concern
is most reduced?
CORRECT: B. Class-imbalance distortion of accuracy and threshold choice A balanced 50/50 target means accuracy is not misleading and the default threshold is less biased. Multicollinearity, overdispersion, and spatial autocorrelation are unrelated to class balance.
29. Which statement correctly contrasts a statsmodels logit workflow with scikit-learn
LogisticRegression for this report?
CORRECT: A. statsmodels emphasizes inferential p-values; scikit-learn emphasizes regularized prediction statsmodels' Logit/GLM output supports inference (standard errors, p-values, confidence intervals), while scikit-learn defaults to regularized estimation tuned for prediction. The other options reverse these roles or falsely claim identical, unconfigured results.
30. In the Task 2 report, backward stepwise elimination removed predictors with p > 0.05.
Which statement best justifies this procedure?
CORRECT: D. It ensures every retained coefficient is statistically significant at the chosen alpha level. Backward stepwise elimination iteratively removes the predictor with the largest p-value above the threshold until all remaining predictors are significant at alpha=0.05, so D is the direct operational guarantee. A is wrong because elimination by p-value is not equivalent to AIC minimization (though related, AIC uses likelihood penalized by parameter count, not p-values). B is false-stepwise selection does not guarantee optimal test accuracy and often overfits. C is false because elimination removes one variable at a time based on significance, not multicollinearity per se.
31. The report states Price is continuous and 'well-suited for linear regression' in a logistic
model predicting IsLuxury. What is the core methodological error?
CORRECT: B. The outcome must be binary; Price is a predictor, and linear regression language is inappropriate. In logistic regression the dependent variable must be binary (IsLuxury); Price is an independent variable, and describing it as 'well-suited for linear regression' confuses the roles of outcome and predictor. A is not required-log transforms are optional and depend on distributional assumptions, not mandatory. C is false because scaling is not required for logistic regression (only helpful for convergence/interpretation). D is false-Price is not perfectly collinear with IsLuxury; otherwise the model would be unidentified.
32. The dataset has 3,500 luxury and 3,500 non-luxury homes. A model predicts all 7,
as non-luxury. What are accuracy and recall for the luxury class?
CORRECT: A. Accuracy = 0.50; Recall (luxury) = 0. With a 50/50 split and all predictions negative, true negatives = 3,500 and false negatives = 3,500, so accuracy = 3,500/7,000 = 0.50. Recall for luxury = TP/(TP+FN) = 0/(0+3,500) = 0.00, exposing the
statsmodels is designed for statistical inference (coefficients, standard errors, p-values, confidence intervals), while scikit-learn emphasizes predictive modeling, pipelines, and evaluation metrics-so a strong report can leverage both. B is false: statsmodels is fully valid for logistic regression. C is false-statsmodels handles categorical predictors via formula API or dummy encoding. D is false-coefficients are identical for unregularized MLE regardless of standardization (only interpretation changes).
36. The report one-hot encodes Garage and Fireplace. Why must one category per variable
be dropped before fitting statsmodels Logit?
CORRECT: B. Full dummy coding causes perfect multicollinearity with the intercept, making the design matrix singular. Including all k dummies plus an intercept creates the dummy variable trap-perfect collinearity-so the design matrix is singular and coefficients are not uniquely estimable. Dropping one level (reference category) resolves this and yields interpretable odds ratios relative to the reference. A is false-dropping a level is about identifiability, not accuracy. C misattributes a p-value requirement. D is false-the trap applies precisely to categorical variables.
37. A model achieves AUC = 0.92 but accuracy = 0.61 at the default 0.5 threshold on an
imbalanced test set. What is the most defensible next step?
CORRECT: B. Tune the classification threshold using the validation set to balance precision and recall. AUC = 0.92 indicates strong rank-ordering ability; the low accuracy at 0.5 reflects a threshold mismatch under class imbalance, so threshold tuning (or class weighting) is the principled fix. A is wrong-accuracy alone is misleading under imbalance. C risks overfitting and does not address threshold choice. D is conceptually wrong-logistic regression is the appropriate classifier; imbalance is handled via thresholds, weights, or resampling, not by switching model families.
38. The report commits after each rubric section. Which GitLab practice best supports
reproducibility and evaluator traceability for D600 Task 2?
CORRECT: C. Use descriptive commit messages, include the notebook/scripts, and tag the final submission. Descriptive commit messages, inclusion of the executable notebook/scripts, and a tag for the final submission support traceability, reproducibility, and rubric alignment. A destroys the audit trail the rubric rewards. B removes evidence of process and hinders reproducibility. D violates submission requirements and prevents the evaluator from verifying results.
39. A report lists a single train/test split with no random seed and no cross-validation.
Which critique is most aligned with D600's emphasis on rigorous results reporting?
CORRECT: A. Results may not be reproducible and may reflect a favorable split; set a seed and add k-fold CV. Without a fixed seed, the split is not reproducible, and a single split can over- or under-state performance; setting a seed and adding k-fold cross-validation improves reliability and matches D600's rigor expectations. B is false-CV is generally preferred for stable estimates even on larger datasets. C is false-random splits and optimizers introduce variability regardless of model type. D is false-stepwise selection is an in-sample procedure and does not substitute for validation.
40. In the Task 2 GitLab workflow, which commit strategy best ensures rubric traceability?
CORRECT: B. A commit per rubric-aligned section with descriptive messages and timestamps. The report states commits were made after each rubric-aligned section with descriptive messages and timestamps, ensuring version tracking and traceability. One final or squashed commit loses section-level traceability, and committing only on evaluator request defeats the purpose of progressive documentation.
41. The research question predicts IsLuxury from SquareFootage, Garage,
RenovationQuality, Price, SchoolRating, and Fireplace. Which critique is most
methodologically serious?
CORRECT: C. Right skew in a predictor is irrelevant to logistic regression's assumptions about the outcome. Logistic regression assumes linearity in the log-odds, not normality of predictors; skew in Price affects linearity and influence, not a normality assumption. Log-transforming may help linearity but is not required by skew alone, nonparametric switching is unjustified, and median dichotomization discards information.
45. The dataset was split 75/25 with one-hot encoding and no scaling. Which statement
about this preprocessing is most accurate for statsmodels logistic regression?
CORRECT: A. One-hot encoding with drop_first avoids perfect multicollinearity from the dummy variable trap. Including all dummy levels plus an intercept creates perfect collinearity, so dropping one level (drop_first) is standard. Scaling is not mandatory for statsmodels convergence, a single split does not guarantee unbiased error, and encoding should be fit on training data to avoid leakage.
46. Backward stepwise elimination removed predictors with p > 0.05 one at a time. Which
interpretation of the final model is most statistically sound?
CORRECT: B. Reported p-values and confidence intervals are optimistic because selection was data-driven. Stepwise selection based on p-values inflates Type I error and yields optimistic standard errors and p-values, so post-selection inference requires caution. It does not establish causality, cannot remove omitted-variable bias, and does not maximize out-of-sample AUC by construction.
47. A fitted logistic model reports an odds ratio of 1.25 for Garage (yes vs no), holding
other predictors constant. What is the correct interpretation?
CORRECT: B. Homes with a garage have 25% higher odds of being luxury than homes without, all else equal. An odds ratio of 1.25 means the odds multiply by 1.25 for garage versus no garage, not a 25-point probability increase. It is not a variance-explained measure, and the log-odds coefficient would be ln(1.25) 0.223, not 1.25.
48. On the 25% test set, a confusion matrix yields TP=600, FP=150, FN=100, TN=650. What
are precision and recall?
CORRECT: A. Precision = 0.80, Recall = 0. Precision = TP/(TP+FP) = 600/750 = 0.80; Recall = TP/(TP+FN) = 600/700 0.857. The other options swap or miscompute these ratios, and 0.75 would require FP=200.
49. The report's final submission must include the GitLab URL and full branch history.
Where and how should the URL be provided per the rubric?
CORRECT: A. In the 'Comments to Evaluator' section, with branch history exported into the submission. The task specifies submitting the repository URL in the 'Comments to Evaluator' section and including an exported full branch history in the final submission. README-only, email, or appendix screenshots do not satisfy the stated submission requirements.