# Mixed factor and numeric model

#### SpoodleBeast

##### New Member
Hi,

I have a predictive model with three predictive variables: two factors, Status and StatusNew; and a numeric one, Weekband. I'm trying to use these three to predict the value of a fourth column, Value.

The model is the attached .txt file in csv format
Code:
transition.map.incomplete <- read.csv('./transition.map.test.txt')
I've tried using glm with lots of different formulae and families, e.g.
Code:
model <- glm(Value ~ I((Weekband)^2) / (Status * StatusNew),
data=transition.map.incomplete,
family = Gamma)
but they all do a poor job of modelling the actual transitions (see attached image):
Code:
transition.map.model <- transition.map.incomplete
transition.map.model\$model <- predict(model, transition.map.incomplete, type="response")

transition.map.model %>%
filter(Weekband <= 52) %>%
ggplot() +
aes(x=Weekband) +
geom_point(aes(y=Value), colour="blue") +
geom_line(aes(y=model), colour="red") +
facet_wrap(~ interaction(Status, StatusNew, sep="->"), ncol=7)
I'm sure there's a way I can build a model without having to consider each transition A->B, A->C,...,D->E,...,G-H,H->A,...,etc. separately.

Any help would be greatly appreciated.

Thanks