Running a logistic model in R involves writing R code that does the
following
There’s a lot of code to write
require(MASS);
require(pscl);
require(equatiomatic)
require(textutils)
#Builds a logistic model
Logistic1= glm(Survived ~ Class+Sex+Age, weights=, family =binomial(link='logit'), na.action=na.exclude,
data=titanic.raw)
#Display theoretical model equation and coefficients
#Display theoretical model
reg_formula = equatiomatic::extract_eq(Logistic1, raw_tex = FALSE,
wrap = TRUE, intercept = "alpha", ital_vars = FALSE)
BSkyFormat(reg_formula)
#Display coefficients
reg_equation = equatiomatic::extract_eq(Logistic1, use_coefs = TRUE,
wrap = TRUE,ital_vars = FALSE, coef_digits = BSkyGetDecimalDigitSetting() )
BSkyFormat(reg_equation)
#Summarizing the model
BSky_Logistic = summary(Logistic1)
BSkyFormat(BSky_Logistic, singleTableOutputHeader="Model Summary")
#Analysis of variance
BSky_anova = anova(Logistic1, test="Chisq")
BSkyFormat(as.data.frame(BSky_anova),singleTableOutputHeader="Analysis of Deviance Table")
BSkyFormat(attr(BSky_anova, "heading"))
#McFadden R2
BSkyFormat( pR2(Logistic1) ,singleTableOutputHeader="McFadden R2")
#odds ratio and 95% confidence interval
BSkyFormat(exp(cbind(OR=coef(Logistic1), confint.glm(Logistic1,level=0.95))),singleTableOutputHeader="Odds ratio(OR) and 95% Confidence interval ")
The Output is not pretty
Use a point and click GUI instead of writing R code for popular
analysis
See the nicely formatted output in tables that you can copy and paste
into Microsoft Word, Excel…