LOGISTIC_REGRESSION {SIMPLE.REGRESSION} | R Documentation |
Logistic regression
Description
Logistic regression analyses with SPSS- and SAS-like output. The output includes model summaries, classification tables, omnibus tests of model coefficients, the model coefficients, likelihood ratio tests for the predictors, overdispersion tests, model effect sizes, the correlation matrix for the model coefficients, collinearity statistics, and casewise regression diagnostics.
Usage
LOGISTIC_REGRESSION(data, DV, forced = NULL, hierarchical = NULL,
ref_category = NULL,
family = 'binomial',
plot_type = 'residuals',
verbose = TRUE)
Arguments
data |
A dataframe where the rows are cases and the columns are the variables. |
DV |
The name of the dependent variable.
|
forced |
(optional) A vector of the names of the predictor variables for a forced/simultaneous
entry regression. The variables can be numeric or factors.
|
hierarchical |
(optional) A list with the names of the predictor variables for each step of a
hierarchical regression. The variables can be numeric or factors.
|
ref_category |
(optional) The reference category for DV.
|
family |
(optional) The name of the error distribution to be used in the model. The options are:
Example: family = 'quasibinomial' |
plot_type |
(optional) The kind of plots, if any. The options are:
Example: plot_type = 'diagnostics' |
verbose |
(optional) Should detailed results be displayed in console? |
Details
This function uses the glm function from the stats package and supplements the output with additional statistics and in formats that resembles SPSS and SAS output. The predictor variables can be numeric or factors.
Predicted values for this model, for selected levels of the predictor variables, can be produced and plotted using the PLOT_MODEL funtion in this package.
Good sources for interpreting logistic regression residuals and diagnostics plots:
Value
An object of class "LOGISTIC_REGRESSION". The object is a list containing the following possible components:
modelMAIN |
All of the glm function output for the regression model. |
modelMAINsum |
All of the summary.glm function output for the regression model. |
modeldata |
All of the predictor and outcome raw data that were used in the model, along with regression diagnostic statistics for each case. |
collin_diags |
Collinearity diagnostic coefficients for models without interaction terms. |
cormat |
The correlation matrix for the model coefficients. |
Author(s)
Brian P. O'Connor
References
Dunn, P. K., & Smyth, G. K. (2018). Generalized linear models
with examples in R. Springer.
Field, A., Miles, J., & Field, Z. (2012).
Discovering statistics using R. Los Angeles, CA: Sage.
Hair, J. F., Black, W. C., Babin, B. J., & Anderson, R. E. (2014).
Multivariate data analysis, (8th ed.).
Lawrence Erlbaum Associates.
Hosmer, D. W., Lemeshow, S., & Sturdivant, R. X. (2013)
Applied logistic regression. (3rd ed.). John Wiley & Sons.
Orme, J. G., & Combs-Orme, T. (2009). Multiple regression with discrete
dependent variables. Oxford University Press.
Pituch, K. A., & Stevens, J. P. (2016).
Applied multivariate statistics for the social sciences: Analyses with
SAS and IBM's SPSS, (6th ed.). Routledge.
Rindskopf, D. (2023). Generalized linear models. In H. Cooper, M. N.
Coutanche, L. M. McMullen, A. T. Panter, D. Rindskopf, & K. J. Sher (Eds.),
APA handbook of research methods in psychology: Data analysis and
research publication, (2nd ed., pp. 201-218). American Psychological Association.
Examples
# forced (simultaneous) entry
LOGISTIC_REGRESSION(data = data_Meyers_2013, DV='graduated',
forced=c('sex','family_encouragement'),
plot_type = 'diagnostics')
# hierarchical entry, and using family = "quasibinomial"
LOGISTIC_REGRESSION(data = data_Kremelburg_2011, DV='OCCTRAIN',
hierarchical=list( step1=c('AGE'), step2=c('EDUC','REALRINC')),
family = "quasibinomial")