[![enter image description here][1]][1] I am trying to change dummy variables in r to my desire dummy variables but the r code I am using did not give the desire result. I have provided the r code and the result I want in the attach image above. Thank you helping.
lowbwt=read.csv("lowbwt_1.csv",header = T)
library(dplyr) lowbwt<-lowbwt %>% + mutate(Black=ifelse(RACE_1=="Black",1,0)) %>% + mutate(Other=ifelse(RACE_1=="Other",0,1)) %>% + mutate(White=ifelse(RACE_1=="White",0,0)) model_1=glm(LOW~RACE_1+AGE+LWT,data=lowbwt,family = "binomial") summary(model_1)
Call: glm(formula = LOW ~ RACE_1 + AGE + LWT, family = "binomial", data = lowbwt)
Deviance Residuals:
Min 1Q Median 3Q Max
-1.4052 -0.8946 -0.7209 1.2484 2.0982
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 2.310563 1.146923 2.015 0.0439 *
RACE_1Other -0.560361 0.512830 -1.093 0.2745
RACE_1White -1.003822 0.498014 -2.016 0.0438 *
AGE -0.025524 0.033252 -0.768 0.4427
LWT -0.014353 0.006523 -2.200 0.0278 *
Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 234.67 on 188 degrees of freedom
Residual deviance: 222.66 on 184 degrees of freedom AIC: 232.66
Number of Fisher Scoring iterations: 4
contrasts(lowbwt$RACE_1) Other White Black 0 0 Other 1 0 White 0 1
But I want produce is the following: Other White Black 1 0 Other 0 1 White 0 0 I White to be base with (0 0) rather than Black as r is giving