0

I am using the glm function in R to ascertain the risk of individual alleles to a disease; it is a case-control study. When I run the glm function, R automatically takes the allele with the lowest digit or in alphabetical order as the reference allele. I need to change this according to the each gene and the most neutral allele (i.e. the allele which has an even distribution among the cases and controls). How do I do this. The code I use currently is;

modelA <- (glm(trait ~ sex + A, data=Almon, family = binomial(link = 'logit')))
Mona
  • 93
  • 1
  • 10

1 Answers1

1

You'll want to use relevel() -- or if you're using the forcats library, fct_relevel() -- to change the levels so that the reference comes first.

Much more here: How to force R to use a specified factor level as reference in a regression?

ravic_
  • 1,731
  • 9
  • 13