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

methods other than "pairwise" for estimate_contrasts() fail #232

Open
pcinereus opened this issue Jul 20, 2023 · 0 comments
Open

methods other than "pairwise" for estimate_contrasts() fail #232

pcinereus opened this issue Jul 20, 2023 · 0 comments

Comments

@pcinereus
Copy link

In the manual for estimate_contrasts, it says:
method: Contrast method. See same argument in emmeans::contrast.
However, only method = "pairwise" seems to work (see MEW below). I think this is due to the following line which assumes that emmeans::contrasts will return two fields (names(level_cols) <- c("Level1", "Level2")) - yet only pairwise will return two fields.

set.seed(123)
dat <- data.frame(y =  rpois(100, 3), F =  gl(4, 20, 100))
dat_glm <- glm(y ~ F, data =  dat, family = poisson(link =  "log"))
dat_glm |> estimate_contrasts(method = "eff") 
dat_glm |> estimate_contrasts(method = "poly") 
cmat <- (cbind('1_vs_2'=c(1,-1,0,0),
              '3_vs_4'=c(0,0,1,-1),
             '1+2_vs_3+4'=c(0.5,0.5,-0.5,-0.5)))
dat_glm |> estimate_contrasts(method = list(F = cmat)) 

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

2 participants
@pcinereus and others