Closed NicolasGensollen closed 2 days ago
Hello,
In the implementation you're referring to, the add operation doesn't perform pairwise addition as one might typically expect with numerical values. Instead, it functions more like an "append" operation in the context of combining terms or variables in a statistical model.
When you use Term A + Term B, the operation combines the two terms by adding the variables from Term B that are not already present in Term A to Term A. This results in a new term that includes all unique variables from both Term A and Term B.
Let's consider two terms representing different variables in a design matrix for a linear model:
Term A: Represents variables [X1, X2] Term B: Represents variables [X2, X3]
Term A + Term B will output [X1, X2, X3] since X3 is the only col that in B but not in A.
So the cause of this problem is just when calling sum it is 0 + termAge. This addition of a numeric type and FixedEffect type is not well handled.
When adding
FixedEffect
terms from a list, I was expecting to get the same results when using thesum()
function and reducing withlambda x, y: x + y
. However, usingsum()
results in an additional columnx0
.Here is a MWE:
I was expecting the same results.
I am using BrainStat
0.3.6
.