-
-
Save Dpananos/bbbe68a9a3998b90d7caab19c22e745e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# LRT | |
data = c(27,24,3,14,9,14,4,6,7,8) | |
m = matrix(data, nrow = 2) | |
theta_null = colSums(m)/sum(m) | |
theta_1 = m[1,]/sum(m[1,]) | |
theta_2 = m[2,]/sum(m[2,]) | |
L0 = dmultinom(colSums(m), prob = theta_null, log=T) | |
L1 = dmultinom(m[1,], prob = theta_1, log=T) + dmultinom(m[2,], prob = theta_2, log=T) | |
lrt = -2*(L1 - L0) | |
# | |
pchisq(lrt, df=4, lower.tail = F) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
LRT
data = c(27,24,3,14,9,14,4,6,7,8)
m = matrix(data, nrow = 2)
theta_null = colSums(m)/sum(m)
theta_1 = m[1,]/sum(m[1,])
theta_2 = m[2,]/sum(m[2,])
L0 = dmultinom(m[1,], prob = theta_null, log=T) + dmultinom(m[2,], prob = theta_null, log=T)
L1 = dmultinom(m[1,], prob = theta_1, log=T) + dmultinom(m[2,], prob = theta_2, log=T)
lrt = -2*(L0-L1)
pchisq(lrt, df=4, lower.tail = F)