Following is the code that I am using to recode the data:
results$Taxis<-as.factor(results$Taxis)
results$ShiftType<-as.factor(results$ShiftType)
results$Sharing<-as.factor(results$Sharing)
results$Mode<-as.factor(results$Mode)
plot(results)
anova<-aov(Service.Level~Taxis+ShiftType+Sharing+Mode,data = results)
summary(anova)
results.coded<-coded.data(results,x1~(Taxis-4500)/3000,x3~(Sharing-50)/50,x4~(Mode-0.5)/0.5)
results.coded
It gives me serial numbers as codes (1,2,3,4,5..) These codes do not change if I change the formula. They remain as they are. Looks like some default coding. Please help me with this!
Data coding is used with continuous predictors, not factors. If interpretation requires those predictors to be factors, don’t try to code them. If they are on a numerical scale and you want to interpret them as such, then you may code them. Take away those as.factor()
calls and it will work.
The advantage of coding is to scale all the variables so are treated more equitably in such methods as steepest ascent. If you’re just trying to fit an equation to the data and don’t plan to do additional experimentation to find an optimum, it really isn’t necessary to code the data.