COUNT_REGRESSION {SIMPLE.REGRESSION} | R Documentation |
Count data regression
Description
Provides SPSS- and SAS-like output for count data regression, including Poisson, quasi-Poisson, and negative binomial models. The output includes model summaries, classification tables, omnibus tests of the model coefficients, overdispersion tests, model effect sizes, the model coefficients, correlation matrix for the model coefficients, collinearity statistics, and casewise regression diagnostics.
Usage
COUNT_REGRESSION(data, DV, forced = NULL, hierarchical = NULL,
family = 'poisson',
offset = NULL,
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.
|
family |
(optional) The name of the error distribution to be used in the model. The options are:
Example: family = 'quasipoisson' |
offset |
(optional) The name of the offset variable, if there is one. This variable
should be in the desired metric (e.g., log). No transformation of an
offset variable is performed internally.
|
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 the negative.binomial function from the MASS 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 count data regression residuals and diagnostics plots:
Value
An object of class "COUNT_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
Atkins, D. C., & Gallop, R. J. (2007). Rethinking how family researchers
model infrequent outcomes: A tutorial on count regression and zero-inflated
models. Journal of Family Psychology, 21(4), 726-735.
Beaujean, A. A., & Grant, M. B. (2019). Tutorial on using regression
models with count outcomes using R. Practical Assessment,
Research, and Evaluation: Vol. 21, Article 2.
Coxe, S., West, S.G., & Aiken, L.S. (2009). The analysis of count data:
A gentle introduction to Poisson regression and its alternatives.
Journal of Personality Assessment, 91, 121-136.
Dunn, P. K., & Smyth, G. K. (2018). Generalized linear models
with examples in R. Springer.
Hardin, J. W., & Hilbe, J. M. (2007). Generalized linear models
and extensions. Stata Press.
Orme, J. G., & Combs-Orme, T. (2009). Multiple regression with discrete
dependent variables. Oxford University Press.
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
COUNT_REGRESSION(data=data_Kremelburg_2011, DV='OVRJOYED',
forced=c('AGE','EDUC','REALRINC','SEX_factor'))
# negative binomial regression
COUNT_REGRESSION(data=data_Kremelburg_2011, DV='HURTATWK',
forced=c('AGE','EDUC','REALRINC','SEX_factor'),
family = 'negbin',
plot_type = 'diagnostics')
# with an offset variable
COUNT_REGRESSION(data=data_Orme_2009_5, DV='NumberAdopted', forced=c('Married'),
offset='lnYearsFostered')