[R] Dependent Variable in Logistic Regression

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Sat Aug 1 20:03:06 CEST 2020


On Sat, 1 Aug 2020, Paul Bernal wrote:

> Hope you are doing great. I want to fit a logistic regression in R, where
> the dependent variable is the covid status (I used 1 for covid positives,
> and 0 for covid negatives), but when I ran the glm, R complains that I
> should make the dependent variable a factor.
>
> What would be more advisable, to keep the dependent variable with 1s and
> 0s, or code it as yes/no and then make it a factor?

Paul,

1 or 0 are equivalent to yes or no, success or failure. All are nomminal
variables so all should be factors, regardless of the coding.

Rich



More information about the R-help mailing list