Models comparison trough Widely applicable information criterion (WAIC), using two data sets with the visit length at the feeder in pig production

1. Model comparison visit length less than 60 seconds (50652 redcords)

1.1. WAIC criterion

print(m1.waic)
## 
## Computed from 30000 by 50652 log-likelihood matrix
## 
##            Estimate    SE
## elpd_waic -167085.7 222.6
## p_waic        141.3   1.8
## waic       334171.5 445.1
## Warning: 2 (0.0%) p_waic estimates greater than 0.4. We recommend trying
## loo instead.
print(m2.waic)
## 
## Computed from 30000 by 50652 log-likelihood matrix
## 
##            Estimate    SE
## elpd_waic -166504.3 225.8
## p_waic        246.1   3.0
## waic       333008.6 451.6
## Warning: 2 (0.0%) p_waic estimates greater than 0.4. We recommend trying
## loo instead.
print(m3.waic)
## 
## Computed from 30000 by 50652 log-likelihood matrix
## 
##            Estimate    SE
## elpd_waic -166504.4 225.8
## p_waic        246.4   3.0
## waic       333008.8 451.6
## Warning: 2 (0.0%) p_waic estimates greater than 0.4. We recommend trying
## loo instead.

1.2. Model comparison

loo_compare(m1.waic,m2.waic, m3.waic)
##        elpd_diff se_diff
## model2    0.0       0.0 
## model3   -0.1       0.3 
## model1 -581.5      36.4
print(compare(m1.waic,m2.waic, m3.waic))
##         elpd_diff se_diff   elpd_waic p_waic    waic     
## m2.waic       0.0       0.0 -166504.3     246.1  333008.6
## m3.waic      -0.1       0.3 -166504.4     246.4  333008.8
## m1.waic    -581.5      36.4 -167085.7     141.3  334171.5

2. Model comparison visit length as the next visit is greater or equal than 600 seconds (6340 records)

2.1. WAIC criterion

print(m1.waic)
## 
## Computed from 30000 by 6340 log-likelihood matrix
## 
##           Estimate    SE
## elpd_waic -21127.6  92.5
## p_waic       127.5   4.6
## waic       42255.1 185.1
## Warning: 26 (0.4%) p_waic estimates greater than 0.4. We recommend trying
## loo instead.
print(m2.waic)
## 
## Computed from 30000 by 6340 log-likelihood matrix
## 
##           Estimate    SE
## elpd_waic -21128.5  92.5
## p_waic       134.9   4.7
## waic       42256.9 184.9
## Warning: 26 (0.4%) p_waic estimates greater than 0.4. We recommend trying
## loo instead.
print(m3.waic)
## 
## Computed from 30000 by 6340 log-likelihood matrix
## 
##           Estimate    SE
## elpd_waic -21128.2  92.5
## p_waic       134.6   4.7
## waic       42256.5 184.9
## Warning: 26 (0.4%) p_waic estimates greater than 0.4. We recommend trying
## loo instead.

2.2. Model comparison

loo_compare(m1.waic,m2.waic, m3.waic)
##        elpd_diff se_diff
## model1  0.0       0.0   
## model3 -0.7       1.2   
## model2 -0.9       0.8
print(compare(m1.waic,m2.waic, m3.waic))
##         elpd_diff se_diff  elpd_waic p_waic   waic    
## m1.waic      0.0       0.0 -21127.6     127.5  42255.1
## m3.waic     -0.7       1.2 -21128.2     134.6  42256.5
## m2.waic     -0.9       0.8 -21128.5     134.9  42256.9