Comments (3)
As the error originates in the emmeans
package, unfortunately, it's kinda hard to detect and throw relevant warnings in modelbased
😕
from modelbased.
df <- iris
df$factor1 <- ifelse(df$Sepal.Width > 3, "A", "B")
df$factor2 <- ifelse(df$Petal.Length > 3.5, "C", "D")
df$factor3 <- ifelse(df$Sepal.Length > 5, "E", "F")
model <- lm(Petal.Width ~ factor1 * factor2 * factor3, data=df)
emmeans::emmeans(model, "factor1")
#> NOTE: Results may be misleading due to involvement in interactions
#> factor1 emmean SE df lower.CL upper.CL
#> A nonEst NA NA NA NA
#> B 1.19 0.101 143 0.993 1.39
#>
#> Results are averaged over the levels of: factor2, factor3
#> Confidence level used: 0.95
Created on 2020-04-16 by the reprex package (v0.3.0)
It seems this is directly related to the marginal means estimation (as modelbased wraps around emmeans
), I think it's because the model is ill-specified, but it should work on some data with enough observations in each combination of factors
from modelbased.
Hello @DominiqueMakowski
thank you for your message. Indeed, if I exclude the three way interaction factor1:factor2:factor3, the code works:
df <- iris
df$factor1 <- ifelse(df$Sepal.Width > 3, "A", "B")
df$factor2 <- ifelse(df$Petal.Length > 3.5, "C", "D")
df$factor3 <- ifelse(df$Sepal.Length > 5, "E", "F")
model <- lm(Petal.Width ~ factor1 * factor2 + factor3 + factor2:factor3, data=df)
modelbased::estimate_contrasts(model, levels = "factor1")
#> NOTE: Results may be misleading due to involvement in interactions
#> Level1 | Level2 | Difference | SE | 95% CI | t | df | p | Difference (std.)
#> --------------------------------------------------------------------------------------------
#> A | B | 0.05 | 0.07 | [-0.08, 0.18] | 0.69 | 144 | 0.489 | 0.06
As soon as I add the three way interaction again, the previous error messages reappear. A warning would be nice, which tells, that the model is ill-specified for this purpose, because the current error messages are difficult to interpret (which lead me to believe it might be a bug, although it was my inability all along).
The point is, that I get the previous error messages also with my original code, which deals with a big lmer model. Now I must assume that this big lmer model is ill-specified? I have to see how I deal with that.
Anyway, thank you very much for your time and help. I really appreciate it.
I close this issue.
from modelbased.
Related Issues (20)
- Fix failing tests HOT 2
- CRAN submission HOT 15
- between_within or ml1 df for post-hoc tests based on glmm HOT 3
- Provide `verbose` parameter to key functions to suppress messages/warnings
- Fix broken example
- Error in CRAN checks on R-devel-windows
- estimate_contrasts , p-value and 95% CI do not agree HOT 4
- Possible bug with estimate_grouplevel() for brms model HOT 5
- `estimate_contrasts()`: Different results using `as.factor()` within or outside formula
- Plotting from `estimate_means()` with a poisson model fails HOT 3
- methods other than "pairwise" for `estimate_contrasts()` fail
- `modelization_approach` vignette fails to render HOT 1
- Pairwise paired contrasts?
- Feature Request: Contrasting Simple Slopes HOT 1
- `visualization_recipe()` for `estimate_slopes()` should not map alpha to discrete values HOT 5
- CRAN submission (deadline 20/02) HOT 2
- Harmonize ggeffects and modelbased
- Keep code R-3.6 compatible
- Unable to install package on cran HOT 4
- CRAN failures HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modelbased.