Last active
August 15, 2016 18:26
-
-
Save davharris/ebbe75fa5e1df5b558d13ddd5de38a4c to your computer and use it in GitHub Desktop.
Shouldn't the zero-inflated negative binomial and hurdle-negative-binomial be different?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(pscl) | |
y = c(86, 0, 29, 0, 16, 0, 20, 0, 0, 1, 2, 0, 0, 96, 0, 7, 0, 0, | |
0, 0, 25, 0, 0, 233, 0, 7, 0, 0, 67, 0, 6, 0, 0, 0, 12, 0, 0, | |
0, 9, 0, 12, 18, 39, 0, 59, 15, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, | |
0, 88, 48, 50, 26, 0, 47, 0, 0, 0, 18, 0, 60, 0, 0, 180, 0, 0, | |
28, 95, 13, 0, 28, 19, 32, 0, 2, 0, 0, 0, 28, 0, 0, 0, 184, 14, | |
0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 6, 21, 68, 0, 0, 0, 3, 9, 0, | |
0, 0, 1, 15, 0, 13, 26, 0, 0, 0, 0, 0, 0, 0, 0, 342, 93, 0, 3, | |
0, 0, 0, 94, 0, 0, 56, 56, 27, 11, 27, 7, 0, 12, 66, 0, 0, 3, | |
2, 0, 30, 0, 0, 0, 5, 6, 0, 116, 0, 82, 173, 53, 0, 8, 0, 0, | |
0, 0, 396, 0, 0, 0, 0, 0, 0, 0, 8, 0, 69, 4, 55, 17, 9, 0, 4, | |
4, 0, 0, 1, 0, 0, 0, 0, 24, 0, 36, 38, 17, 147, 0, 156, 0, 0, | |
0, 0, 5, 1, 91, 0, 112, 73, 0, 0, 0, 25, 0, 162, 9, 184, 11, | |
51, 72, 1, 0, 0, 26, 0, 92, 0, 5, 0, 0, 12, 0, 163, 0, 0, 0, | |
6, 0, 0, 15, 0, 0, 320, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
0, 0, 0, 0, 12, 0, 2, 83, 17, 0, 0, 116, 0, 0, 0, 16, 0, 0, 0, | |
0, 5, 0, 0, 0, 164, 26, 35, 3, 0, 11, 46, 0, 0, 0, 0, 0, 0, 0, | |
56, 139, 5, 0, 1, 0, 48, 1, 0, 183, 0, 0, 110, 12, 41, 0, 0, | |
0, 0, 0, 1, 13, 0, 136, 13, 0, 9, 10, 1, 80, 148, 0, 0, 18, 52, | |
7, 16, 16, 0, 0, 0, 0, 1, 0, 11, 0, 0, 51, 76, 0, 0, 13, 0, 9, | |
0, 79, 0, 0, 8, 17, 0, 4, 157, 0, 0, 257, 0, 1, 20, 0, 0, 18, | |
1, 109, 0, 4, 41, 0, 65, 0, 3, 0, 12, 151, 61, 11, 15, 0, 693, | |
41, 0, 46, 0, 26, 0, 0, 7, 0, 0, 2, 0, 0, 0, 0, 0, 625, 0, 1, | |
34, 12, 10, 0, 44, 2, 0, 115, 217, 0, 0, 0, 0, 14, 0, 18, 2, | |
13, 22, 0, 0, 0, 20, 0, 0, 35, 34, 0, 22, 0, 3, 0, 0, 2, 148, | |
0, 0, 21, 0, 0, 88, 37, 55, 0, 0, 0, 0, 0, 183, 0, 0, 83, 0, | |
0, 0, 0, 75, 0, 0, 21, 0, 0, 0, 0, 3, 0, 0, 2, 0, 37, 118, 0, | |
8, 1, 0, 38, 0, 0, 0, 114, 47, 0, 224, 7, 0, 0, 0, 97, 0, 0, | |
26, 0, 0, 0, 43, 0, 65, 308, 11, 14, 38, 0, 0, 0, 2, 0, 9, 59, | |
0, 0, 54, 26, 0, 1, 40, 1, 15, 81, 0, 124, 0, 3, 0, 1, 0, 6, | |
69, 320, 26, 0, 0, 116, 0, 0, 10, 0, 0, 0, 0, 62, 1, 0, 0, 0, | |
138) | |
hurdle_model = hurdle(y ~ 1 | 1, dist = "negbin") | |
inflat_model = zeroinfl(y ~ 1 | 1, dist = "negbin") | |
# Identical coefficients and likelihoods? | |
coef(hurdle_model)[1] - coef(inflat_model)[1] # 3e-9 | |
AIC(hurdle_model) - AIC(inflat_model) # 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment