0
$\begingroup$

I am trying to analyse some data in R that has one continuous dependent variable (x) and two categorical variables (sex: M/F, surface: D/V). My main goal is to understand if sex and surface affect 'x'. Biologically, I am interested in whether

  1. male dorsal surfaces have more 'x' than male ventral (similar for females) and if
  2. male dorsals have more 'x' than female dorsals (similar for the ventrals).

This is for 10 different species. Here is where I am confused

  1. Do I carry out a GLM of the form: 'x~Sex*Surface' per species and then carry out pairwise comparisons using 'emmeans' to find out specific differences? Or
  2. Can I combine sex and surface into one categorical independent variable which has four levels and carry out Kruskal-Wallis or ANOVAs individually per species as some species satisfy assumptions while others dont.

Alternatively, can I carry out a GLM followed by emmeans with the combined variable instead of keeping sex and surface separate i.e., 'x~SexSurface'?

Conceptually they seem similar to me and so I am unable to decide which method would be best suited for this analysis.

$\endgroup$

1 Answer 1

0
$\begingroup$

I would not do it separately by species. I see you said some species satisfy assumptions but others do not, but I would do one analysis with all three variables and whatever interactions you think are appropriate. And, if assumptions are violated, you can use some form of robust regression or quantile regression or some other method that does not make those assumptions

As to your question about an interaction vs. a single variable with both included, if you make a single variable then the output will not let you separate the effects of the variables. That may be OK with you, but I think the usual way is an interaction.

$\endgroup$
3
  • $\begingroup$ Thank you for your response, just wanted to clarify that I'm not looking at how species vary with respect to each other. So, in that case, would adding species as an explanatory variable be necessary? $\endgroup$
    – Noob29
    Commented Nov 30, 2023 at 14:52
  • $\begingroup$ Adding species to the model means you have one model, rather than 10. It also allows species to be a covariate, because, even if you aren't interested in it as a variable, it may affect the other parameter estimates. $\endgroup$
    – Peter Flom
    Commented Nov 30, 2023 at 14:54
  • $\begingroup$ I see, thank you. I understand if this isnt within the scope of the question, but I did carry out these analyses and plotted boxplots per species. But I see that the differences that come up as significant are different depending on which method is used. Now, I do not want to imply that I am doing tests mainly looking for significant differences but visually what I expect to be different from the boxplot (and what a kruskal wallis post-hoc might show as different) aren't necessarily the same in the model. I'm just trying to make sense of how this can be. Any insights would be very helpful! $\endgroup$
    – Noob29
    Commented Nov 30, 2023 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.