I made a OLR model using polr(). The dependent variable is the outcome of the match. A home win is a 2, a draw 1 and an away win (=home loss) is 0. I checked the assumptions (multi-collinearity, proportional odds...) and they seem fine. However, when I run the model I get some illogical dependent coefficients. The red cards, for example, give the opposite of what can be expected: red cards for the home team have a positive significant coefficient, while red cards for the away team have a negative significant coefficient. I checked the data and it doesn't seem like the red cards are swapped, they belong to the right teams. Furthermore, it seems like most times the team with the red card doesn't win too. 1300 of the 7300 matches have red cards, so it doesn't seem like they are underrepresented either. Am I missing something here? What did I do wrong?
Here is some code:
m4_test <- polr(WHOWINS ~ H_NUMBER_RED + A_NUMBER_RED + H_Pts_Percentage_EUR + A_Pts_Percentage_EUR,data=basetable4_reg, Hess=TRUE)
#Get the p-values
#Store the coefficient table
m4.coef_test <- data.frame(round(coef(summary(m4_test)),5))
#Calculate and store p values
m4.coef_test$pval <- pnorm(abs(m4.coef_test$t.value),lower.tail=F)*2
m4.coef_test
#Visualize table
stargazer(m4_test,type="html",out="m4_test.htm")
The results are:
summary(m4_test)
Call:
polr(formula = WHOWINS ~ H_NUMBER_RED + A_NUMBER_RED + H_Pts_Percentage_EUR +
A_Pts_Percentage_EUR, data = basetable4_reg, Hess = TRUE)
Coefficients:
Value Std. Error t value
H_NUMBER_RED 0.84042 0.079512 10.570
A_NUMBER_RED -0.72626 0.074311 -9.773
H_Pts_Percentage_EUR -0.05309 0.001499 -35.417
A_Pts_Percentage_EUR 0.05027 0.001432 35.101
Intercepts:
Value Std. Error t value
2|1 -0.4215 0.0895 -4.7094
1|0 1.0331 0.0905 11.4210
Residual Deviance: 13188.37
AIC: 13200.37
Table with p values:
m4.coef_test
Value Std..Error t.value pval
H_NUMBER_RED 0.84042 0.07951 10.56966 4.119855e-26
A_NUMBER_RED -0.72626 0.07431 -9.77314 1.468294e-22
H_Pts_Percentage_EUR -0.05309 0.00150 -35.41694 9.368040e-275
A_Pts_Percentage_EUR 0.05027 0.00143 35.10123 6.455702e-270
2|1 -0.42150 0.08950 -4.70938 2.484714e-06
1|0 1.03306 0.09045 11.42103 3.283196e-30
The structure is as follows:
str(basetable4_reg)
'data.frame': 7913 obs. of 5 variables:
$ H_NUMBER_RED : int 0 0 0 0 0 0 0 0 0 0 ...
$ A_NUMBER_RED : int 0 0 0 0 0 0 0 0 0 1 ...
$ H_Pts_Percentage_EUR: num 33.3 0 0 0 33.3 ...
$ A_Pts_Percentage_EUR: num 33.3 100 100 100 33.3 ...
$ WHOWINS : Factor w/ 3 levels "2","1","0": 2 3 3 3 2 3 1 1 2 2 ...
Furthermore, I have found using the graphical method for checking proportional odds assumption that the values were red cards=2/3 or yellow=7/8, the proportional odds assumption does not hold. Could this be the cause of my weird results? And can I still look at other variables were the assumption does seem to hold? Code for proportional odds assumption(with all variables included):
basetable4_reg_num <- basetable4_reg
basetable4_reg_num$WHOWINS <- as.numeric(levels(basetable4_reg_num$WHOWINS))[basetable4_reg_num$WHOWINS]
#Last assumption: proportional odds
#The relationship between each pair of outcome groups has to be the same
sf <- function(y) {
c('Y>=0' = qlogis(mean(y >= 0)),
'Y>=1' = qlogis(mean(y >= 1)),
'Y>=2' = qlogis(mean(y >= 2)))
}
#Filter out some unusual matches (8yellows,3 reds for 1 team)
basetable4_reg_num <- dplyr::filter(basetable4_reg_num, H_NUMBER_YELLOW != 8 & A_NUMBER_YELLOW != 8 & H_NUMBER_RED != 3 & A_NUMBER_RED != 3)
(s4 <- with(basetable4_reg_num, summary(WHOWINS ~ spi1 + spi2 + H_NUMBER_YELLOW + H_NUMBER_RED + A_NUMBER_YELLOW + A_NUMBER_RED + H_cluster_2 + A_cluster_2 +
H_cluster_3 + A_cluster_3 + H_Pts_Percentage_EUR + A_Pts_Percentage_EUR + H_STRONG_OPPONENT +
A_STRONG_OPPONENT + Rest_Difference_EUR + H_FORM_EUR + A_FORM_EUR + H_break_EUR + A_break_EUR +
H_START_H_EUR + A_START_H_EUR + H_carryover_EUR + A_carryover_EUR + H_SPI_First5 + A_SPI_First5, fun=sf)))
s4[, 4] <- s4[, 4] - s4[, 3]
s4[, 3] <- s4[, 3] - s4[, 3]
s4
plot(s4, which=1:3, pch=1:3, xlab='logit', main=' ',xlim=range(s4[,3:4]))
Output:
WHOWINS N= 7908
+--------------------+------------+----+----+----+----------+
| | |N |Y>=0|Y>=1|Y>=2 |
+--------------------+------------+----+----+----+----------+
|spi1 |[15.9,53.0) |1977|Inf |0 |-1.0569194|
| |[53.0,63.0) |1979|Inf |0 |-1.0161198|
| |[63.0,73.3) |1975|Inf |0 |-1.0895256|
| |[73.3,96.6] |1977|Inf |0 |-1.0642268|
+--------------------+------------+----+----+----+----------+
|spi2 |[15.9,52.5) |1978|Inf |0 |-1.0419683|
| |[52.5,62.5) |1979|Inf |0 |-1.1741643|
| |[62.5,72.7) |1975|Inf |0 |-1.0844946|
| |[72.7,96.8] |1976|Inf |0 |-0.9532292|
+--------------------+------------+----+----+----+----------+
|H_NUMBER_YELLOW |0 |1230|Inf |0 |-0.9611662|
| |1 |2195|Inf |0 |-0.9644353|
| |2 |2248|Inf |0 |-1.0575133|
| |3 |1355|Inf |0 |-1.0423640|
| |4 | 622|Inf |0 |-1.1662965|
| |5 | 177|Inf |0 |-1.0883802|
| |6 | 71|Inf |0 |-0.9221403|
| |7 | 10|Inf |0 |-0.9808293|
+--------------------+------------+----+----+----+----------+
|H_NUMBER_RED |0 |7264|Inf |0 |-1.0072793|
| |1 | 607|Inf |0 |-1.2562432|
| |2 | 37|Inf |0 |-1.6137763|
+--------------------+------------+----+----+----+----------+
|A_NUMBER_YELLOW |0 | 834|Inf |0 |-0.8696210|
| |1 |1901|Inf |0 |-0.9520453|
| |2 |2285|Inf |0 |-0.9992627|
| |3 |1650|Inf |0 |-1.0768545|
| |4 | 827|Inf |0 |-1.1357586|
| |5 | 299|Inf |0 |-1.0880402|
| |6 | 92|Inf |0 |-1.1409147|
| |7 | 20|Inf |0 |-2.0053336|
+--------------------+------------+----+----+----+----------+
|A_NUMBER_RED |0 |7042|Inf |0 |-0.9986183|
| |1 | 815|Inf |0 |-1.2406663|
| |2 | 51|Inf |0 |-1.9076889|
+--------------------+------------+----+----+----+----------+
|H_cluster_2 |No |7768|Inf |0 |-1.0091839|
| |Yes | 140|Inf |0 |-1.0332204|
+--------------------+------------+----+----+----+----------+
|A_cluster_2 |No |7780|Inf |0 |-1.0105230|
| |Yes | 128|Inf |0 |-0.9363063|
+--------------------+------------+----+----+----+----------+
|H_cluster_3 |No |1992|Inf |0 |-1.0146787|
| |Yes |5916|Inf |0 |-1.0508935|
+--------------------+------------+----+----+----+----------+
|A_cluster_3 |No |2008|Inf |0 |-0.9388268|
| |Yes |5900|Inf |0 |-1.1029711|
+--------------------+------------+----+----+----+----------+
|H_Pts_Percentage_EUR|[ 0.0, 34.2)|2133|Inf |0 |-1.2214355|
| |[34.2, 44.7)|1858|Inf |0 |-1.2183999|
| |[44.7, 60.2)|1966|Inf |0 |-1.0843063|
| |[60.2,100.0]|1951|Inf |0 |-1.1211798|
+--------------------+------------+----+----+----+----------+
|A_Pts_Percentage_EUR|[ 0.0, 34.2)|2339|Inf |0 |-1.5060732|
| |[34.2, 43.5)|1618|Inf |0 |-1.1830666|
| |[43.5, 58.5)|2007|Inf |0 |-1.0830832|
| |[58.5,100.0]|1944|Inf |0 |-1.0057895|
+--------------------+------------+----+----+----+----------+
|H_STRONG_OPPONENT |No |5829|Inf |0 |-1.1251621|
| |Yes |2079|Inf |0 |-0.9843824|
+--------------------+------------+----+----+----+----------+
|A_STRONG_OPPONENT |No |5797|Inf |0 |-1.0614260|
| |Yes |2111|Inf |0 |-1.1012423|
+--------------------+------------+----+----+----+----------+
|Rest_Difference_EUR |[-158, 0) |2501|Inf |0 |-1.0896414|
| | 0 |2995|Inf |0 |-1.0013136|
| | 1 |1525|Inf |0 |-0.9891562|
| |[ 2,93] | 887|Inf |0 |-0.9629256|
+--------------------+------------+----+----+----+----------+
|H_FORM_EUR |[ 0.0, 33.3)|2450|Inf |0 |-1.0091252|
| |[33.3, 50.0)|2374|Inf |0 |-1.0757834|
| |[50.0, 66.7)|1221|Inf |0 |-1.1282879|
| |[66.7,100.0]|1863|Inf |0 |-0.9635144|
+--------------------+------------+----+----+----+----------+
|A_FORM_EUR |[ 0.0, 33.3)|2263|Inf |0 |-1.0342653|
| |[33.3, 50.0)|2357|Inf |0 |-1.0422817|
| |[50.0, 73.3)|1990|Inf |0 |-1.0846315|
| |[73.3,100.0]|1298|Inf |0 |-0.9889462|
+--------------------+------------+----+----+----+----------+
|H_break_EUR |No |6536|Inf |0 |-1.0147032|
| |Yes |1372|Inf |0 |-0.9930284|
+--------------------+------------+----+----+----+----------+
|A_break_EUR |No |6591|Inf |0 |-1.0197689|
| |Yes |1317|Inf |0 |-0.9578141|
+--------------------+------------+----+----+----+----------+
|H_START_H_EUR |No |3882|Inf |0 |-1.0048689|
| |Yes |4026|Inf |0 |-1.0160930|
+--------------------+------------+----+----+----+----------+
|A_START_H_EUR |No |3978|Inf |0 |-1.0027812|
| |Yes |3930|Inf |0 |-1.0159319|
+--------------------+------------+----+----+----+----------+
|H_carryover_EUR |[ 20.9,105) |1977|Inf |0 |-0.9494935|
| |[105.1,124) |1980|Inf |0 |-1.0342376|
| |[124.4,141) |1974|Inf |0 |-1.0134742|
| |[141.1,191] |1977|Inf |0 |-1.0487209|
+--------------------+------------+----+----+----+----------+
|A_carryover_EUR |[ 23,106) |1979|Inf |0 |-0.9280581|
| |[106,125) |1976|Inf |0 |-1.0737660|
| |[125,142) |1976|Inf |0 |-0.9633857|
| |[142,191] |1977|Inf |0 |-1.0930709|
+--------------------+------------+----+----+----+----------+
|H_SPI_First5 |[158,277) |1985|Inf |0 |-0.9429083|
| |[277,319) |1980|Inf |0 |-1.0571709|
| |[319,348) |1977|Inf |0 |-1.0758229|
| |[348,402] |1966|Inf |0 |-0.9636855|
+--------------------+------------+----+----+----+----------+
|A_SPI_First5 |[158,274) |1982|Inf |0 |-0.9420248|
| |[274,318) |1984|Inf |0 |-1.0908272|
| |[318,347) |1968|Inf |0 |-0.9653452|
| |[347,402] |1974|Inf |0 |-1.0389595|
+--------------------+------------+----+----+----+----------+
|Overall | |7908|Inf |0 |-1.0092373|
+--------------------+------------+----+----+----+----------+