# How to overcome Coefficients: (4 not defined because of singularities) [duplicate]

Stats is not my strong point but trying to run a regression. I'm aware that it happens because some of these variables are perfectly collinear. However, I do not know how to fix this? Any help would be much appreciated. This is my current script:

### Deviant coding of 'Sex' variable
dat_full$$deviant_sex <- scale(ifelse(dat_full$$sex == "Female",0,1), scale = F)

## Mean centre predictors

### Complexity
dat_full$$stnsci <- scale(ifelse(dat_full$$complexity == "scientific", 1, 0), center = T, scale = F)
dat_full$$stnnon <- scale(ifelse(dat_full$$complexity == "none", 1, 0), center = T, scale = F)

### Timing
dat_full$$aftbef <- scale(ifelse(dat_full$$timing == "before", 1, 0), center = T, scale = F)
dat_full$$aftnon <- scale(ifelse(dat_full$$timing == "none", 1, 0), center = T, scale = F)

#regression
fulldata <- lm(verdict ~ stnsci + stnnon +
aftbef + aftnon + stnsci:aftbef +
stnsci:aftnon + stnnon:aftbef +
stnnon:aftnon , data=dat_full)
summary (fulldata) • How many possible values are there for complexity, or for timing? You appear to be trying to have new variables for every level of a categorical variable. – gung - Reinstate Monica May 9 '19 at 16:25
• I think you will find the information you need in the linked thread. Please read it. If it isn't what you want / you still have a question afterwards, come back here & edit your question to state what you learned & what you still need to know. Then we can provide the information you need without just duplicating material elsewhere that already didn't help you. – gung - Reinstate Monica May 9 '19 at 16:27

formula = verdict ~ stnsci + stnnon + aftbef