Q:

How to change the logistic regression output in R

this is my first question so i give my very best do describe it as good as possible. For a project i want to use logistic regression models and show the results in some graphs. At the moment i have the following problem: When i create my logistic model with the following code:
m3<- glm(alive ~ seatbelt*dvcat + sex + ageOFocc + airbag, family = binomial, data = nassCDS)
summary(m3)

the output looks like this:

alive is a binary variable with 1 for alive and 0 for dead.
seatbelt is a factor with the levels seatbelted and none.
sex is male or female.
ageOFocc is the age of the driver.
airbag is a factor with the levels airbag or none.
dvcat is a factor with 5 levels representing the impact speed of the vehicle.
Because i am not that proficient with R I wanted to recreate the steps on a website i found. So i basically copied their code and expected the same output. But there are tiny differences. The Output from the website showed the coefficients with "Seatbeltseatbelted" and "airbagairbag" whereas my output shows the values for "seatbeltnone" and "airbagnone" (marked yellow on the picture). Can i change this?
I already testet it on a different computer and had the same problem. A friend of mine tried it on hers and she got the "correct" output. I Reinstalled  R and R Studio and reinstalled Windows on my PC, but nothing seems to work for me.
I hope you can help me :) Kind regards Jan

A:

The problem might be that you mess up the reference levels of seatbelt and airgbag. Try to use relevel() to reset their reference levels to none, and run glm() again.
nassCDS$seatbelt <- relevel(nassCDS$seatbelt, ref = "none")
nassCDS$airbag <- relevel(nassCDS$airgbag, ref = "none")

Theoretically, those functions like lm() and glm() take the first level of a factor as its reference level, and levels of a factor are sorted alphabetically by default. Therefore, if a factor contains two levels, e.g. airbag and none, then airbag will be treated as its reference level. relevel() can move the level you set in the ref argument to the first position, and therefore the model will treat it as reference.

