We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
library(tidyverse) library(BradleyTerry2) ex_data <- tibble::tribble( ~player_1, ~player_2, ~wins_1, ~wins_2, "Model1", "Model2", 7, 3 ) %>% mutate( player_1 = factor(player_1, levels = c("Model1", "Model2")), player_2 = factor(player_2, levels = c("Model1", "Model2")) ) mod <- BTm(cbind(wins_1, wins_2), player_1, player_2, data = ex_data) mod #> Bradley Terry model fit by glm.fit #> #> Call: BTm(outcome = cbind(wins_1, wins_2), player1 = player_1, player2 = player_2, #> data = ex_data) #> #> Coefficients: #> ..Model2 #> -0.8473 #> #> Degrees of Freedom: 1 Total (i.e. Null); 0 Residual #> Null Deviance: 1.646 #> Residual Deviance: 6.661e-16 AIC: 4.642 summary(mod) #> #> Call: #> BTm(outcome = cbind(wins_1, wins_2), player1 = player_1, player2 = player_2, #> data = ex_data) #> #> Deviance Residuals: #> [1] 0 #> #> Coefficients: #> Estimate Std. Error z value Pr(>|z|) #> ..Model2 -0.8473 0.6901 -1.228 0.22 #> #> (Dispersion parameter for binomial family taken to be 1) #> #> Null deviance: 1.6457e+00 on 1 degrees of freedom #> Residual deviance: 6.6613e-16 on 0 degrees of freedom #> AIC: 4.6423 #> #> Number of Fisher Scoring iterations: 3 BTabilities(mod) #> Error in contr %*% coef: non-conformable arguments
Created on 2020-07-03 by the reprex package (v0.3.0)
devtools::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.0.0 (2020-04-24) #> os macOS Catalina 10.15.5 #> system x86_64, darwin17.0 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz America/New_York #> date 2020-07-03 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.0) #> backports 1.1.8 2020-06-17 [1] CRAN (R 4.0.0) #> blob 1.2.1 2020-01-20 [1] CRAN (R 4.0.0) #> boot 1.3-25 2020-04-26 [1] CRAN (R 4.0.0) #> BradleyTerry2 * 1.1-2 2020-02-03 [1] CRAN (R 4.0.0) #> brglm 0.6.2 2019-04-02 [1] CRAN (R 4.0.0) #> broom 0.5.6 2020-04-20 [1] CRAN (R 4.0.0) #> callr 3.4.3 2020-03-28 [1] CRAN (R 4.0.0) #> cellranger 1.1.0 2016-07-27 [1] CRAN (R 4.0.0) #> cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.0) #> colorspace 1.4-1 2019-03-18 [1] CRAN (R 4.0.0) #> crayon 1.3.4.9000 2020-06-09 [1] Github (r-lib/crayon@dcf6d44) #> DBI 1.1.0 2019-12-15 [1] CRAN (R 4.0.0) #> dbplyr 1.4.4 2020-05-27 [1] CRAN (R 4.0.0) #> desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.0) #> devtools 2.3.0 2020-04-10 [1] CRAN (R 4.0.0) #> digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.0) #> dplyr * 1.0.0 2020-05-29 [1] CRAN (R 4.0.0) #> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.0) #> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.0) #> fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.0) #> forcats * 0.5.0 2020-03-01 [1] CRAN (R 4.0.0) #> fs 1.4.1 2020-04-04 [1] CRAN (R 4.0.0) #> generics 0.0.2 2018-11-29 [1] CRAN (R 4.0.0) #> ggplot2 * 3.3.2 2020-06-19 [1] CRAN (R 4.0.0) #> glue 1.4.1 2020-05-13 [1] CRAN (R 4.0.0) #> gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.0) #> gtools 3.8.2 2020-03-31 [1] CRAN (R 4.0.0) #> haven 2.3.1 2020-06-01 [1] CRAN (R 4.0.0) #> highr 0.8 2019-03-20 [1] CRAN (R 4.0.0) #> hms 0.5.3 2020-01-08 [1] CRAN (R 4.0.0) #> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.0) #> httr 1.4.1 2019-08-05 [1] CRAN (R 4.0.0) #> jsonlite 1.6.1 2020-02-02 [1] CRAN (R 4.0.0) #> knitr 1.29 2020-06-23 [1] CRAN (R 4.0.0) #> lattice 0.20-41 2020-04-02 [1] CRAN (R 4.0.0) #> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.0) #> lme4 1.1-23 2020-04-07 [1] CRAN (R 4.0.0) #> lubridate 1.7.9 2020-06-08 [1] CRAN (R 4.0.0) #> magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.0) #> MASS 7.3-51.6 2020-04-26 [1] CRAN (R 4.0.0) #> Matrix 1.2-18 2019-11-27 [1] CRAN (R 4.0.0) #> memoise 1.1.0 2017-04-21 [1] CRAN (R 4.0.0) #> minqa 1.2.4 2014-10-09 [1] CRAN (R 4.0.0) #> modelr 0.1.8 2020-05-19 [1] CRAN (R 4.0.0) #> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.0) #> nlme 3.1-147 2020-04-13 [1] CRAN (R 4.0.0) #> nloptr 1.2.2.1 2020-03-11 [1] CRAN (R 4.0.0) #> pillar 1.4.4 2020-05-05 [1] CRAN (R 4.0.0) #> pkgbuild 1.0.8 2020-05-07 [1] CRAN (R 4.0.0) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.0) #> pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.0) #> prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.0) #> processx 3.4.2 2020-02-09 [1] CRAN (R 4.0.0) #> profileModel 0.6.0 2019-04-03 [1] CRAN (R 4.0.0) #> ps 1.3.3 2020-05-08 [1] CRAN (R 4.0.0) #> purrr * 0.3.4 2020-04-17 [1] CRAN (R 4.0.0) #> qvcalc 1.0.2 2020-02-15 [1] CRAN (R 4.0.0) #> R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.0) #> Rcpp 1.0.4.6 2020-04-09 [1] CRAN (R 4.0.0) #> readr * 1.3.1 2018-12-21 [1] CRAN (R 4.0.0) #> readxl 1.3.1 2019-03-13 [1] CRAN (R 4.0.0) #> remotes 2.1.1 2020-02-15 [1] CRAN (R 4.0.0) #> reprex 0.3.0 2019-05-16 [1] CRAN (R 4.0.0) #> rlang 0.4.6 2020-05-02 [1] CRAN (R 4.0.0) #> rmarkdown 2.3.1 2020-06-23 [1] Github (rstudio/rmarkdown@b53a85a) #> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.0) #> rvest 0.3.5 2019-11-08 [1] CRAN (R 4.0.0) #> scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.0) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.0) #> statmod 1.4.34 2020-02-17 [1] CRAN (R 4.0.0) #> stringi 1.4.6 2020-02-17 [1] CRAN (R 4.0.0) #> stringr * 1.4.0 2019-02-10 [1] CRAN (R 4.0.0) #> testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.0) #> tibble * 3.0.1 2020-04-20 [1] CRAN (R 4.0.0) #> tidyr * 1.1.0 2020-05-20 [1] CRAN (R 4.0.0) #> tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.0) #> tidyverse * 1.3.0 2019-11-21 [1] CRAN (R 4.0.0) #> usethis 1.6.1.9000 2020-06-23 [1] Github (r-lib/usethis@5475c46) #> vctrs 0.3.1 2020-06-05 [1] CRAN (R 4.0.0) #> withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.0) #> xfun 0.15 2020-06-21 [1] CRAN (R 4.0.0) #> xml2 1.3.2 2020-04-23 [1] CRAN (R 4.0.0) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.0/Resources/library
I think that either a coefficient is being dropped or not enough term names are dropped:
debug: contr <- contrasts(fac)[player.names, ] Browse[2]> debug: if (!is.null(attr(coef, "na.action"))) { contr <- contr[, -attr(coef, "na.action"), drop = FALSE] } Browse[2]> debug: est <- contr %*% coef Browse[2]> contr Model1 Model2 0 1 Browse[2]> coef ..Model2 -0.8472979 Browse[2]> Error in contr %*% coef : non-conformable arguments
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Created on 2020-07-03 by the reprex package (v0.3.0)
Session info
I think that either a coefficient is being dropped or not enough term names are dropped:
The text was updated successfully, but these errors were encountered: