I am using Julia version1.8.5. There was an error " LoadError: UndefVarError: @formula not defined" when I ran "fmla = @formula(outcome ~ GP(X1, X2) | region + covarA + covarB + categ)” in julia. The code and error is showed in the following picture. What should I do to deal with it ? I’ll really appreciated it if anyone can help me out.

You need to actually load a package which defines a `@formula`

macro - judging from your regression specification you might be looking for `MixedModels`

Thanks for your answer. But there are still few problems that I am confused. First, I don’t know how to find the package which @formula belongs to. Second, besides MixedModels, I also find running “using StatsModels” before using @formula also works, but I don’t know the dfference between MixedModels and StatsModels or other packages including @formula. Which one should I choose. I will appreciated it if you can help to explain it.

How did you know how to write `@formula`

, and how did you know to specify your regression the way you did (ie using the `|`

random effects operator)?

It is true that the are multiple packages which use the `@formula`

macro, `StatsModels`

is the base package defining the `@formula`

DSL but many other packages use and extend it. The question of which one to use can’t be answered on generally, it’s up to you to decide based on the problem at hand, eg got a plain vanilla OLS linear model or probit you might use `GLM`

, if you have high dimensional fixed effects you might use `FixedEffectModels`

, if you want to fit a mixed model then you’re probably interested in `MixedModels`

etc

Thanks for your detailed explanation. It really helps me.