Skip to content

Commit

Permalink
Discordant comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ms609 committed Feb 6, 2025
1 parent fe8b456 commit 5fbef31
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion R/Concordance.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,22 @@ QuartetConcordance <- function (tree, dataset = NULL) {
iChoices * choose(inBinJ, 2)
}, 1))
}, 1))

# To be discordant, we must select a pair of taxa from TT and from FF;
# and the character states must group each T with an F
# e.g. T0 T1 F0 F1
# T0 T1 F0 F2 would not be discordant - just uninformative
discordant <- sum(apply(combn(nCol, 2), 2, function (ij) prod(tab[, ij])))

# Only quartets that include two T and two F can be decisive
# Quartets must also include two pairs of characters
decisive <- concordant + discordant
c(concordant, decisive)
} else {
c(0L, 0L)
}
}))
ifelse(is.nan(quarts[2]), NA_real_, quarts[1] / quarts[2])
ifelse(is.nan(quarts[[2]]), NA_real_, quarts[[1]] / quarts[[2]])
}), names(splits))
}

Expand Down

0 comments on commit 5fbef31

Please sign in to comment.