Logistic regression in r with categorical variables.
how I have to implement a categorical variable in a binary logistic regression in R? I want to test the influence of the professional fields (student, worker, teacher, self-employed) on the probability of a purchase of a product.
In my example y is a binary variable (1 for buying a product, 0 for not buying). - x1: is the gender (0 male, 1 female) - x2: is the age (between 20 and 80) - x3: is the categorical variable (1=student, 2=worker, 3=teacher, 4=self-employed) set.seed(123) y x1 x2 x3 test summary(test) If I implement x3 (the professional fields) in my regression above, I get the wrong estimates/interpretation for x3.
What I have to do to get the right influence/estimates
for the categorical variable (x3)?
Комментариев нет:
Отправить комментарий