Comments (4)
The problem is that the model you want to fit has only one term, the variable:period
interaction. There is no way mixed
can test this interaction. Remember that mixed removes all the term in a stepwise manner and tests them against the remaining model. If the interaction is removed, the model has no more fixed effect so cannot be fitted. That is why one also cannot test a model with mixed
that only has an intercept and not other terms (there remains no model to compare it with after removing the single term).
However, you can test a binomial model, by transforming the frequencies to a probability:
cbpp$prob <- with(cbpp, incidence / size)
m1p <- mixed(prob ~ period + (1 | herd), weights = size, family = binomial, data = cbpp, method = "LRT")
m1p
## Effect df Chisq p.value
## 1 period 3 25.61 *** <.0001
from afex.
OK, I agree that that was a particularly bad example of an intercept-less model. How about the below, though? (the model doesn't make any sense but just to use it as an example problem)
> mixed(Petal.Width ~ 0 + Sepal.Length + Sepal.Width + Petal.Length + (1|Species),iris)
Contrasts set to contr.sum for the following variables: Species
Numerical variables NOT centered on 0 (i.e., interpretation of all main effects might be difficult if in interactions): Sepal.Length, Sepal.Width, Petal.Length
Fitting 4 (g)lmer() models:
[.Error in x[, ii] : subscript out of bounds
Again, with the intercept, this model is fit just fine.
from afex.
Can you tell me what your goal is? I have the suspicion that the tests of the intercept less models are problematic and are not worth to implement.
You can fit binomial models with cbind(incidence,size) ~ period + (1|herd)
by transforming the left side to a proportion and passing the number of observations via weights
.
from afex.
(sorry, accidentally posted this with another account, reposting:)
Of course. I have a lot of trials of EEG data (32 electrodes, 900-ms timeslices). I'm trying to determine which electrodes & at what timepoints I should be looking at to run my statistical analyses. This is normally done by running, at every timepoint, a multivariate ANOVA with 32 dependent variables, and plotting the resulting 32 * 900 (assuming for simplicity a sampling rate of 1ms) p-values in a heatmap (with 32 electrodes on the y axis, time on the x axis, p-value as the color). This helps you determine your time window and electrode subset on which you want to run your actual statistical analysis. Note that this method of running 32 * 900 F-tests has a huge multiple comparisons problem, which is dealt with by running a permutation equivalent of the ANOVA analysis.
What I want to do is see whether the results I obtain from this standard methodology will be different if I use mixed-effects models instead of ANOVAs (which cannot incorporate random effects). There is no permutation test for lmer models as far as I know, but a similar approach is available in parametric bootstrapping. This is what led me to afex::mixed. (I realize that using bootstrapping with my current approach will be prohibitively slow, but I can cluster some of the electrodes/bin my timepoints/etc.)
The problem then is that I want to somehow run a multivariate model (it's actually linear regression, the - poor - example above was simply the first freely-available multivariate dataset I could find, which happened to be binomial instead of gaussian only by coincidence). The cbind(electrode1,electrode2,... trick doesn't work with mixed, but neither does the workaround described in comment 1, viz. to melt my 32 dependent variables into a factor and using that as the first predictor in the model - even before the intercept. The latter seemed a more general problem than the former, hence why I reported that as a bug.
from afex.
Related Issues (20)
- Following up significant interactions in GLMM HOT 5
- anova() works different for mixed versus lme4 objects HOT 4
- Other suitable contrasts than contr.sum HOT 1
- error for running mixed() with a null model (no fixed effect) HOT 1
- Understanding inconsistencies between `aov_car()` and equivalents HOT 1
- Adding geoms to `afex_plot()` HOT 5
- Degree of Freedom in aov_car output HOT 3
- Can aov_car report 95% confidence interval? HOT 6
- Unexpected outcomes when setting contrasts manually HOT 3
- Anova table data heading incorrect HOT 2
- Issues with next version of ggplot2 HOT 2
- [Feature request] Add ability to automatically simplify mixed models following Singman and Kellen (2019)
- Residuals with `mixed`-fitted model HOT 3
- Issue with next version of ggbeeswarm HOT 1
- Bump minimum needed R version to `4.1` for `{pbkrtest}` update?
- Issue with upcoming ggplot2 version HOT 3
- [Sugestion] MMRM (GLS) for Afex: Kenward-Roger and Satterthwaite for free :) HOT 1
- Error in ctrl$optimizer <- optimizer[..i] : object of type 'symbol' is not subsettable
- emmeans gives wrong results for afex_aovs if the at = argument is reversed HOT 1
- Getting variance for the effect instead of each level of the effect? HOT 3
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 afex.