R for Beginners: Modeling Regression Effects Using REffects Library

January 29, 2017
By

[This article was first published on R – Traversing Bits, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Regression is a very popular statistical technique. In this post, I’ll show you how to plot regression effects using the R ‘effects’ library (https://cran.r-project.org/web/packages/effects/effects.pdf). This library provides a set of easy-to-write commands to visualize the effects of each variable in your regression model. The visualizations provide easy-to-understand plots that are very helpful when you interpret your model.

Here’s a simple R script for a logistic regression model plotted using the R effects library.

##############################################################################

logit1 <- glm(Hashtag ~ COMSTRS+COMCOP+ADVSS+BOUND+IDENT+GRPCOM+INFODIS, data = data, family = “binomial”)
summary(logit1)

library(effects)
plot(allEffects(logit1))
#########################################################

Here’re the results:

Call:
glm(formula = Hashtag ~ COMSTRS + COMCOP + ADVSS + BOUND + IDENT +
GRPCOM + INFODIS, family = “binomial”, data = data)

Deviance Residuals:
Min 1Q Median 3Q Max
-1.5409 -1.3369 0.8532 1.0259 2.1899

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -2.0149 0.5323 -3.785 0.000153 ***
COMSTRS 2.3823 0.5386 4.423 9.73e-06 ***
COMCOP 2.8381 0.6027 4.709 2.49e-06 ***
ADVSS 2.6210 0.7355 3.564 0.000366 ***
BOUND 0.3499 0.6732 0.520 0.603244
IDENT -0.2877 0.7094 -0.406 0.685086
GRPCOM 1.0341 0.8612 1.201 0.229852
INFODIS 1.4351 0.5823 2.465 0.013716 *

Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

Null deviance: 1260.0 on 908 degrees of freedom
Residual deviance: 1132.8 on 901 degrees of freedom
AIC: 1148.8

Number of Fisher Scoring iterations: 4

 
Chamil Rathnayake

The post R for Beginners: Modeling Regression Effects Using REffects Library appeared first on Traversing Bits.

To leave a comment for the author, please follow the link and comment on their blog: R – Traversing Bits.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)