This document loads insurance data from a CSV file, splits the data into training and test sets, checks for outliers in age, vintage, and annual premium variables, runs a logistic regression on the training set with response as the target, predicts probabilities on the test set, compares actual and predicted values for the first 10 records, and calculates gains metrics to evaluate model performance.
This document loads insurance data from a CSV file, splits the data into training and test sets, checks for outliers in age, vintage, and annual premium variables, runs a logistic regression on the training set with response as the target, predicts probabilities on the test set, compares actual and predicted values for the first 10 records, and calculates gains metrics to evaluate model performance.
This document loads insurance data from a CSV file, splits the data into training and test sets, checks for outliers in age, vintage, and annual premium variables, runs a logistic regression on the training set with response as the target, predicts probabilities on the test set, compares actual and predicted values for the first 10 records, and calculates gains metrics to evaluate model performance.
This document loads insurance data from a CSV file, splits the data into training and test sets, checks for outliers in age, vintage, and annual premium variables, runs a logistic regression on the training set with response as the target, predicts probabilities on the test set, compares actual and predicted values for the first 10 records, and calculates gains metrics to evaluate model performance.
# use glm() (general linear model) with family = "binomial" to fit a logistic # regression. logit.reg <- glm(Response ~ ., data = train, family = "binomial") options(scipen=999) summary(logit.reg)
# use predict() with type = "response" to compute predicted probabilities.
logit.reg.pred <- predict(logit.reg, test, type = "response") head(logit.reg.pred)