Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

How to force R to use a specified factor level as reference in a regression?

$
0
0

How can I tell R to use a certain level as reference if I use binary explanatory variables in a regression?

It's just using some level by default.

lm(x ~ y + as.factor(b)) 

with b {0, 1, 2, 3, 4}. Let's say I want to use 3 instead of the zero that is used by R.


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>