I don't think there is enough information in the data to do anything at the 0.95 level of significance. Look at a tabular split:
> with( dat3, table(Accident_Severity, Light_Conditions, Road_Type))
, , Road_Type = 1
Light_Conditions
Accident_Severity 1 2 3
one 0 2 4
three 2 157 158
two 0 14 35
, , Road_Type = 2
Light_Conditions
Accident_Severity 1 2 3
one 0 0 0
three 1 17 11
two 0 0 0
, , Road_Type = 3
Light_Conditions
Accident_Severity 1 2 3
one 0 2 2
three 3 269 251
two 0 38 34
So there is no split that isn't obvious I suppose. The function thinks it is already sufficiently split. If you lower the min-criterion you get splits:
mytree<- ctree(Accident_Severity ~ Road_Type + Light_Conditions + Road_Surface_Conditions,
data=dat3, control=ctree_control( mincriterion =0.50) )
print(mytree)
#----------------------
Conditional inference tree with 4 terminal nodes
Response: Accident_Severity
Inputs: Road_Type, Light_Conditions, Road_Surface_Conditions
Number of observations: 1000
1) Light_Conditions <= 2; criterion = 0.653, statistic = 4.043
2) Road_Surface_Conditions <= 1; criterion = 0.9, statistic = 6.742
3)* weights = 193
2) Road_Surface_Conditions > 1
4)* weights = 312
1) Light_Conditions > 2
5) Road_Type <= 1; criterion = 0.792, statistic = 5.187
6)* weights = 197
5) Road_Type > 1
7)* weights = 298
plot(mytree)
If you use factor() around the variable names they are handles as non-ordinal:
mytree2 <- ctree(Accident_Severity ~ factor(Road_Type) + factor(Light_Conditions) + factor(Road_Surface_Conditions),
data=dat3, control=ctree_control( mincriterion =0.50) )
print(mytree2)
#------------------------
Conditional inference tree with 2 terminal nodes
Response: Accident_Severity
Inputs: factor(Road_Type), factor(Light_Conditions), factor(Road_Surface_Conditions)
Number of observations: 1000
1) factor(Road_Type) == {1, 3}; criterion = 0.635, statistic = 6.913
2)* weights = 971
1) factor(Road_Type) == {2}
3)* weights = 29