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.
Example: DV = 'outcomeVar'.

forced

(optional) A vector of the names of the predictor variables for a forced/simultaneous entry regression. The variables can be numeric or factors.
Example: forced = c('VarA', 'VarB', 'VarC')

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.
Example: hierarchical = list(step1=c('VarA', 'VarB'), step2=c('VarC', 'VarD'))

ref_category

(optional) The reference category for DV.
Example: ref_category = 'alive'

family

(optional) The name of the error distribution to be used in the model. The options are:

  • "binomial" (the default), or

  • "quasibinomial", which should be used when there is overdispersion.

Example: family = 'quasibinomial'

plot_type

(optional) The kind of plots, if any. The options are:

  • 'residuals' (the default),

  • 'diagnostics', for regression diagnostics, and

  • 'none', for no plots.

Example: plot_type = 'diagnostics'

verbose

(optional) Should detailed results be displayed in console?
The options are: TRUE (default) or FALSE. If TRUE, plots of residuals are also produced.

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") 


[Package SIMPLE.REGRESSION version 0.1.9 Index]