ecophys_student
ecophys_student

Reputation: 13

How to fix emtrends error message "argument 'options' is missing, with no default"

I'm trying to run a mixed effect model that's composed of 2 fixed effect variables, where the first fixed effect has has two levels while the other represents continuous data. The continuous data is pH and I have 12 unique values that are associated with different subplots of my treatment block. Because I'm using continuous data, using the cld(emmeans()) framework only gives me the average pH of the 12 unique values, so I'm interested in using emtrends() to determine if the slope of the relationship between my response variable and pH is significantly different from 0.

I have already tried the code that follows later with this comment. When I run my model, we find that there are significant effects of pH on the response variable. However, when I try to determine whether the slope of the regression line is significantly different from zero, I receive the following error: "Error in emm_basis.merMod(model, attr(data, "terms"), [email protected]$xlev, : argument "options" is missing, with no default"

An example of the data frame:

site   species     nitrogen_treat    pH        response_var
   A         B          nit_added    3.4               36.8
   A         B          nit_added    3.4               35.7
   B         A        no_nitrogen    5.6               32.1
   A         C        no_nitrogen    5.6               30.1
   B         D        no_nitrogen    4.3               30.2
   C         C          nit_added    3.1               37.2
   C         A          nit_added    7.2               10.2

So my code for the lmer function is as follows:

lm <- lmer(response_var ~ nitrogen_treat * pH + 
               (1 | site) + (1 | species))

Which I then used to try the emtrends() function, which is not functional:

emtrends(lm, ~1, var = "pH")

I've also experimented with swapping "~1" with "~nitrogen_treat", but I continually receive the error message I mentioned above. I'd appreciate any insight on why I'm receiving these error messages!

Upvotes: 1

Views: 580

Answers (1)

Russ Lenth
Russ Lenth

Reputation: 6760

This is a new bug that I identified and fixed in the current working version on github. However, you can work around it by adding options = list() in theemtrends() call.

Upvotes: 2

Related Questions