Skip to content

Commit f0fe1e2

Browse files
authored
Make has_ranef robust to univariate RHS (#75)
As a single term cannot be a random effect (I believe!) `has_ranef` should return `false` for a single RHS variable.
1 parent 0aac727 commit f0fe1e2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/data_constructors.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ Returns `true` if any of the terms in `formula` is a `FunctionTerm` or false
9797
otherwise.
9898
"""
9999
function has_ranef(formula::FormulaTerm)
100-
return any(t -> t isa FunctionTerm{typeof(|)}, formula.rhs)
100+
if formula.rhs isa StatsModels.Term
101+
return false
102+
else
103+
return any(t -> t isa FunctionTerm{typeof(|)}, formula.rhs)
104+
end
101105
end
102106

103107
"""

0 commit comments

Comments
 (0)