-
Notifications
You must be signed in to change notification settings - Fork 32
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
Multivariate EMM results from aov_ez #45
Comments
I have now implemented
I have also changed the help page which now reads:
Does this solve this issue for you? |
Important noteIn Testing the exampleI can't get the example to run on my system:
This could be a problem on my system. But I updated all packages and the problem persists. FWIW, here is my session information:
(wouldn't it be nice if those namespaces were alphabetized?) |
Are you sure you are using the CRAN version of And regarding the package version. I have simply added the corresponding check to the function (instead to the package level). If one has an older version one can still use emmeans. However, if the user wants to use multivariate tests, it fails with an appropriate error message (so given that your package version is high enough, not for you). |
Henrik, Please note that the error I experienced occurred while trying to fit the model; I never got as far as calling any
I traced it further into
which tries to access non-existing columns:
I tried tricking it into working by creating At any rate, I'm fairly certain that the error isn't occurring in emmeans. I wonder if there are changes you haven't yet pushed to github? |
Hi Russ, The reason for this bug is that you use the development version of So I guess when you downgrade it should work. |
Aha! Indeed, downgrading to the current CRAN version of car (rather than the development version) makes all the difference. I now get it to work as shown. I still suggest including Also, it might be helpful to include a multivariate illustration in |
I will definitely add more examples about the new functionality. And I agree that automatic updating of I should maybe also consider demoting the dependency of |
I have finally added the Now, I only need to figure out how to provide methods for |
Henrik,
Yes. Just export the functions ref_grid.whatever and emm_basis.whatever. I’ll try to write more later but am with a lot of people.
Russ
…Sent from my iPhone
On Jun 24, 2018, at 9:59 AM, Henrik Singmann <[email protected]<mailto:[email protected]>> wrote:
I have finally added the emmeans version number to the package. This afex version will be submitted to CRAN today.
Now, I only need to figure out how to provide methods for emmeans while only having it in Suggests and not in Depends. Any ideas?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#45 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AZiXrzus4QWM7yJYac_eMUutXpI4eYwFks5t_6k3gaJpZM4SK4on>.
|
Henrik,
I’m home now from a trip so can answer more completely...
First, remove emmeans from Imports and add to Suggests.
From NAMESPACE, remove any imports(emmeans) or importsFrom(emmeans) calls. Also remove all instances of S3method(recover_data) and S3method(emm_basis).
Instead of providing methods, simply export recover_data.myobject and emm_basis.myobject. (Note: so R checks will require you to document these; BUT it is enough to include them in \alias{} somewhere and you don’t actually have to show them in \usage{}.)
If your methods call emmeans methods, just reference emmeans – i.e., emmeans::emm_basis(...). Contrary to what you may have been led to believe, this does NOT require you to import those things from emmeans.
Also, while sometimes it is desirable to wrap things like this in if(requireNamespace(“emmeans”)) {...}, it is NOT necessary in this instance. The reason is that your emm_basis.myobject() method will never be called except when emmeans::ref_grid wants to call that method; and thus, this if() will always be TRUE.
I have gained some recent experience with all of this stuff. emmeans 1.2 had over 100 dependencies because, like a fool, I added brms to Imports. In emmeans 1.2.1, I moved brms to Suggests, and it has 48 dependencies:
tools::package_dependencies("emmeans", recursive = TRUE)
$`emmeans`
[1] "estimability" "ggplot2" "graphics" "methods" "stats" "utils"
[7] "nlme" "coda" "multcomp" "plyr" "mvtnorm" "xtable"
[13] "lattice" "digest" "grid" "gtable" "MASS" "reshape2"
[19] "scales" "tibble" "lazyeval" "survival" "TH.data" "sandwich"
[25] "codetools" "Rcpp" "grDevices" "stringr" "zoo" "RColorBrewer"
[31] "dichromat" "munsell" "labeling" "R6" "viridisLite" "Matrix"
[37] "splines" "cli" "crayon" "pillar" "rlang" "assertthat"
[43] "colorspace" "utf8" "glue" "magrittr" "stringi" "tools"
In the next version, which I hope to submit within a day or two, I moved ggplot2, multcomp, and nlme to Suggests, and I’ve cut it down to 9:
imports = c("estimability", "graphics", "methods", "stats", "utils", "plyr", "mvtnorm", "xtable")
unique(c(imports, unlist(tools::package_dependencies(imports, recursive = TRUE))))
[1] "estimability" "graphics" "methods" "stats" "utils" "plyr"
[7] "mvtnorm" "xtable" "Rcpp"
I remember your expressing dissatisfaction once that emmeans required multcomp -- not any more!
Cheers,
Russ
From: Henrik Singmann <[email protected]>
Sent: Sunday, June 24, 2018 9:59 AM
To: singmann/afex <[email protected]>
Cc: Lenth, Russell V <[email protected]>; Author <[email protected]>
Subject: Re: [singmann/afex] Multivariate EMM results from aov_ez (#45)
I have finally added the emmeans version number to the package. This afex version will be submitted to CRAN today.
Now, I only need to figure out how to provide methods for emmeans while only having it in Suggests and not in Depends. Any ideas?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#45 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AZiXrzus4QWM7yJYac_eMUutXpI4eYwFks5t_6k3gaJpZM4SK4on>.
|
Hi Russ, Thanks for the detailed explanation. I have tried to move it to Suggests and had the problem that I have just yesterday pushed a new version of Cheers, |
I have just pushed a version to github where |
Henrik, Sounds promising! I took a quick glance at your Guessing that this is a hectic time for you as you prepare to move to a new position. My hopes that everything goes smoothly and you'll be quickly settled in the new place. |
Apologies for digging up such an ancient thread, but I've been looking into this option myself for how we handle follow-up tests in the JASP RM ANOVA. After a chat with Henrik some years ago, I added this option to JASP, but I now want to make the multivariate model the default. I cannot find much information about the underlying models/functions though - are there any resources that explain the difference between univariate/multivariate in more detail? Thanks for your help, and for your respective packages - they make my life a lot easier =) |
Hi Johnny, To be quite honest I am not sure about the proper mathematical differences between both methods. However, I had a student do some simulations on the Type I error properties recently. The first results indeed support switching to multivariate as it seems to maintain Type I errors better. As soon as I have the report I am happy to post more details. Cheers, |
The help page for
aov_ez
states:I think this is somewhat misleading, in that it is true only because the implementation of
emm_basis.aov_ez
relies on theaov
results. It appears thataov_ez
also fits a multivariate model, which is returned in thelm
member of the object. If that were actually used fully, users could obtain EMMs based on the multivariate model. Those results would not have the deficiencies mentioned above.To illustrate, here is an example from the help page for
aov_ez
:Here is the reference grid for the
lm
member of the object:So lets use the
mult.names
option to sort these out:Now compare the results:
The predictions are the same, but the SEs and df for
aez.mult
are obtained from the multivariate model.afex could provide an option so that the user may choose which analysis they want. This can be done by adding, say, a
mode
argument toemm_basis.afex_aov
, that can have values like"multivariate"
(would use thelm
member like in this example) and"univariate"
(the current default). See current emmeans support for such aslme
objects (simple) orclm
(complex) to see how this may be done. I think all you need to do in this case is to callemm_basis
for thelm
member and setmisc$ylevs
to the needed levels.The text was updated successfully, but these errors were encountered: