Argument 'autocor' should be specified within the 'formula' argument

I’m running a mixed-effects model with two (maybe three) random variables so at the end of running my model I get a warning:
Argument ‘autocor’ should be specified within the ‘formula’ argument. See ?brmsformula for help.

I read the help page but I really don’t know how to choose the autocor type.
My response variable is a binary factor and the independent variables contain mostly binary factors and continuous variables.

So my question is how do I choose the specification of “autocor”?

Hi, sorry for not answering earlier. Could you share the full code you use to invoke brms, and also (a subset) of the data, if possible?

Also what is the exact version of brms you are using?

See ?brms::arma for examples how to use autocor terms now.

Hey, sorry I never got round to replying to this. Now the journal editor is asking about this! So I need to fix it.

The code of the model is below. In model1, they are all categorical binary variables, model2 has one continuous variable Intransitivity05, the others are categorical as in model1. I’ve also attached a subset of the data. Thank you

model1= brm (Case~ Affirmation+ Affectedness+ Causative+ Telicity+ Tense+ Punctuality+

Person+ NumberObj+ Mood+ Kinesis+ NumberSubj+

AgencySubj* AnimacyObj+ Participants* Causative+

Participants* AgencySubj+ AgencySubj* Causative+

Concreteness* Participants+ Count* Participants+

Group* Participants+ (1| Verb), data= training,

family=bernoulli (link=“logit” ),iter=3000 , cores=4 , seed=123 , save_all_pars = TRUE ,

control = list (max_treedepth = 15 ), prior=set_prior (“cauchy(0,2.5)” , class=“b” ),

set_prior (“cauchy(0,10)” , class=“Intercept” ))

model2_dat= brm (Case~ Transitivity05+ Causative+ Tense+

Person+ NumberSubj+ Group+ (1| Verb), data= training,

family=bernoulli (link=“logit” ),iter=3000 ,

cores=4 , seed=123 , save_all_pars = TRUE , control = list (max_treedepth = 15 ),

prior=set_prior (“cauchy(0,2.5)” , class=“b” ), set_prior (“cauchy(0,10)” , class=“Intercept” ))

mini_df.csv (635.9 KB)

We’ll need a bit more information here. What kind of an autocorrelation structure are you trying to introduce?

As Paul said above, you can see examples of specifying autocorrelation structures by calling ?brms::arma. Additionally, you can see the list of available structures here: http://paul-buerkner.github.io/brms/reference/autocor-terms.html

Yeah my question is more basic I guess and it’s how I choose the kind of correlation structure, I simply am not familiar with this concept. Is there a default one I could use? or something I can read about? Thank you.

I think you might be confusing two things:

  • Correlation structure between random effects (i.e. when you have something like (1 + x | y), brms will model the correlation between the coefficients for intercept (1) and x, while when using (1 + x || y) those correlations will not be modelled (i.e. they are assumed to be 0). In some models users also specify a given correlation matrix (i.e. correlation is not estimated, but is non-zero)
  • Autocorrelation structures which handle the correlations between residuals (i.e. the “errors”). Those are used primarily for time-series and spatial models.

Since you don’t seem to have a spatial or time series model, maybe the reviewer is not inquiring about autocorrelation, but about correlations between random effects? (but obviously hard to guess without seeing the exact wording).

Hi,
The reviewer was concerned about the warning Argument ‘autocor’ should be specified within the ‘formula’ argument. See ?brmsformula for help. that I get when the model has finished running. So what you’re saying is that this warning is not relevant because I don’t have a spatial or a time series model, I can report this then.

1 Like

No concern needed. But I am unsure why this warning popped up if you did not specify autocor? Can you share the model that causes this warning?

1 Like

The code of the model is below. In model1, they are all categorical binary variables, model2 has one continuous variable Intransitivity05, the others are categorical as in model1. The data is attached to a previous message if you need to have a look at it.

model1= brm (Case~ Affirmation+ Affectedness+ Causative+ Telicity+ Tense+ Punctuality+

Person+ NumberObj+ Mood+ Kinesis+ NumberSubj+

AgencySubj* AnimacyObj+ Participants* Causative+

Participants* AgencySubj+ AgencySubj* Causative+

Concreteness* Participants+ Count* Participants+

Group* Participants+ (1| Verb), data= training,

family=bernoulli (link=“logit” ),iter=3000 , cores=4 , seed=123 , save_all_pars = TRUE ,

control = list (max_treedepth = 15 ), prior=set_prior (“cauchy(0,2.5)” , class=“b” ),

set_prior (“cauchy(0,10)” , class=“Intercept” ))

model2_dat= brm (Case~ Transitivity05+ Causative+ Tense+

Person+ NumberSubj+ Group+ (1| Verb), data= training,

family=bernoulli (link=“logit” ),iter=3000 ,

cores=4 , seed=123 , save_all_pars = TRUE , control = list (max_treedepth = 15 ),

prior=set_prior (“cauchy(0,2.5)” , class=“b” ), set_prior (“cauchy(0,10)” , class=“Intercept” ))

There was a typo in your model. You did set a comma wrong when you tried to specify your prior as

prior = set_prior (“cauchy(0,2.5)” , class=“b” ), 
  set_prior (“cauchy(0,10)” , class=“Intercept” )

but you only passed the first argument to the prior and the second one to autocor leading to the warning. Please write your priors appropriately, for example, as

prior = set_prior (“cauchy(0,2.5)” , class=“b” ) +
  set_prior (“cauchy(0,10)” , class=“Intercept” )
1 Like

Oh wow, what a dumb error. Thank you!