Skip to content

simplification of hyper3 objects by cancellation #267

Description

@RobinHankin

Consider the hyper3 likelihood function for the observation $a\succ b\succ b$. This should be $\frac{a}{a+2b}\cdot\frac{b}{2b}\cdot\frac{b}{b}$. It is reasonable to expect the final two terms, viz $\frac{b}{2b}$ and $\frac{b}{b}$, to cancel out. Now, the final term of $\frac{b}{b}$ is cancelled out [I think num3() adds a c(b=1) with power 1, and den3() decerements the power of c(b=1) so the back end performs the cancellation]; but the penultimate factor $\frac{b}{2b}$ is not cancelled. In idiom we have c(b=1)^1 and c(b=2)^-1:

library("hyper2")
ordervec2supp3(c("a","b","b"))
#> log( (a=1)^1 * (a=1, b=2)^-1 * (b=1)^1 * (b=2)^-1)

[of course, the factor of $\frac{1}{2}$ does not matter, for likelihood is defined only up to a multiplicative constant]. However, it is computationally inefficient. It would be nice to find and perform such cancellations. Pairs such as c(a=2,b=3) and c(a=4, b=6) should similarly cancel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions