Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] elo.run.multiteam ignores initial.elos #62

Open
BenoitLondon opened this issue Feb 19, 2024 · 0 comments
Open

[BUG] elo.run.multiteam ignores initial.elos #62

BenoitLondon opened this issue Feb 19, 2024 · 0 comments

Comments

@BenoitLondon
Copy link

Hi, first thanks for this great package, it is very interesting and nicely designed!

I ran into the issue with elo.run.multiteam where it ignores intial ratings so for now I rewrote the function to pass it to elo.run (not sure it s the correct way but looks ok)

elo.run.multiteam2 <- function (formula, data, na.action, subset, k = NULL, initial.elos = NULL, 
          ...) 
{
    Call <- match.call()
    Call[[1L]] <- quote(elo::elo.model.frame)
    Call$required.vars <- c("elos", "k", "group", "regress")
    Call$ncol.k <- 2
    Call$ncol.elos <- 1
    mf <- eval(Call, parent.frame())
    if (nrow(mf) == 0) 
        stop("No (non-missing) observations")
    Terms <- stats::terms(mf)
    if (any(mf$adjust.A != 0)) 
        warning("Any adjustments using 'adjust()' are being ignored.")
    mf2 <- multiteam_model_frame(mf)
    er <- elo.run(wins.A ~ elo.A + elo.B + k(k) + group(group) + 
                      regress(regress, to = attr(mf$regress, "to"), by = attr(mf$regress, 
                                                                              "by")), data = mf2, 
                  initial.elos = initial.elos,...)
    er$Call <- Call
    er$terms <- Terms
    er$na.action <- stats::na.action(mf)
    er$n.matches <- nrow(mf)
    class(er) <- c("elo.run.multiteam", class(er))
    er
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant