Model a binary dependent response variable as a relationship between one or more explanatory variables by fitting a logistic regression model.
A binomial logistic regression models a binary dependent variable with two outcomes by one or more independent or predictor variables.
If the binary outcomes in the dependent variable are labelled '0' and '1' then fitted and predicted values of a logistic model are the log-odds for the value labelled '1'. The log-odds can be converted to a probability by the logistic function with a probability of 1 being certainly belonging to '1'.
In this module, if a dependent variable with more than two values is selected, then the values in the dependent variable will be revalued so that the first level represents a failure and the rest represent a success.
The example below shows how to use the Logistic Regression module to model the
diagnosis variable (response) using a number of tumour measurements (predictor variables). The
diagnosis variable is binary, indicating whether the tumour is malignant or benign.
The output below shows the estimated logistic regression model for this problem. It also includes a graph of residuals plotted against the fitted values.
The module output is the printed
summary of a generalized linear model
glm created in R. The summary includes the estimated coefficients and their standard errors, z-score, and p-values. More details on this output can be found in the R documentation for
In our example, p-values tell us that all of the tumour measurements are statistically significant for predicting the probability that a tumour is malignant.
|outcome_var||Yes||Column Input. Text, Boolean, Integer||A binary variable to be used as the dependent variable in the model.|
|model_var1||Yes||Any column other than the column chosen for outcome_var.||A required first independent variable to include in the model.|
|model_var2||No||Any column other than the column chosen for outcome_var.||An optional second predictor variable.|
|model_var3||No||Any column other than the column chosen for outcome_var.||An optional third predictor variable.|
|model_var4||No||Any column other than the column chosen for outcome_var.||An optional fourth predictor variable.|
|model_var5||No||Any column other than the column chosen for outcome_var.||An optional fifth predictor variable.|
|include_intercept||Yes||Boolean||Whether to include an intercept term in the model|