# How to write down a logistic regression formula for continuous and categorical variables?

I have a logistic regression with five explanatory variables (x) and Y is binary. I will present a small work tomorrow on a powerpoint and wondering what the neatest way is to write my logistic regression?

my variables: x_1: categorical, with the categories: teachers, biomathematics, economics and mathematics. Mathematics is the reference variable.

x_2:age, continuous

x_3: gender(Woman=1, man=0)

x_4:preparatory course: (Yes=1, No=0)

x_5: calendar, continuous

I have received a total brain release and can not figure out how to write the nicely on the presentation. Could someone write down the formula to me?

• Just curious, what is a "total brain release?" Also, can you do these two things? i) write the formula with ONE continuous predictor and ii) write the formula with ONE dichotomous predictor. – Penguin_Knight Jun 1 '15 at 16:42

The formalism used to write models in R can be quite handy, in this case with factor variables explicitly noted:

Y ~ age + calendar + factor(teacher) + factor(gender) + factor(prep_course)

You could expand to indicate more specifically that this is a logistic regression, and I suppose to indicate the reference levels of the factor variables (although that probably isn't so important for your presentation).

If you're going to explain the model as percent change of odds, I would use the same equation.

$$\frac{\pi(x)}{1-\pi(x)} = e^{\alpha + \beta_1teacher + \beta_2biomathematics + \beta_3economics + \beta_4age + \beta_5woman + \beta_6prep + \beta_7calendar}$$

But given 5 dummy variables, I agree that this might be cumbersome for a powerpoint slide. Have you considered using an equation for just the continuous effects and creating a separate table for all the categorical effects?

$$\frac{\pi(x)}{1-\pi(x)} = \gamma e^{\beta_4age+ \beta_7calendar}$$

                  mathematics teachers biomathematics economics
man    no prep     gamma_1
man    prep        gamma_2
woman  no prep     gamma_3
woman  prep


Then fill out the entire table with the evaluated coefficients as percent increase over the equation. \begin{align} \gamma_1 &= 100(e^\alpha-1)\%\\ \gamma_2 &= 100(e^{\alpha + \beta_6}-1)\%\\ \gamma_3 &= 100(e^{\alpha + \beta_5 + \beta_6}-1)\%\\\ ... \end{align}