1
$\begingroup$

I am new to lmertrees. I am having trouble analyzing how individual stimuli in my data clusters together on the basis of how some participants answered to them in three different conditions. My code throws the following error:

Warning in matrix(0, nrow = mi, ncol = nl) :
  NAs introduced by coercion to integer range
Error in matrix(0, nrow = mi, ncol = nl) : 
  invalid 'nrow' value (too large or NA)

I think it is suggesting that my partitioning variable (the stimuli) has too many levels for the lmertree to handle. It has 37 levels. This is the formula of my lmertree:

dataF.mTree <- lmertree(Response ~ Condition * Country + Trial.Order
                            | (1 + Condition | Participant.ID) + (1 + Condition | Stimuli.ID)
                            | Stimuli.ID,
                            data = dataF)

And this is the structure of my data:

Participant.ID  Country      Trial.Order  Event.ID  Condition   Response
P01             Spain        1            E01       Zero           12
P01             Spain        2            E02       Partial        67
P01             Spain        3            E03       Full           85
P02             England      3            E01       Partial        45
P02             England      2            E02       Full           69
P02             England      1            E03       Zero            0
P03             Netherlands  2            E01       Full          100
P03             Netherlands  1            E02       Zero            6
P03             Netherlands  3            E03       Partial        30

I read in the internet that some clustering packages in r can handle more partitioning levels than others. Is this right? In those posts people suggested to reduce the number of levels by combining them to form a smaller set of levels, but in my case it is not possible. I truly need to analyze which items cluster together depending on the responses that people gave. Any ideas?

$\endgroup$

1 Answer 1

0
$\begingroup$

For splitting a categorical variable with $k$ levels into 2 groups, there are $2^{k-1} - 1$ possibilities.

In classical regression trees with constant fits in the nodes, you do not need to consider all of these explicitly. It is sufficient to order the $k$ levels by the mean of the response and then search $k$ possible splits.

For the case with more complex linear models in the nodes I'm not aware of such a shortcut. Hence, lmtree() and based on that lmertree() explicitly has to try out all $2^{k-1} - 1$ possibilities which is computationally infeasible.

Therefore, one possibility to avoid searching like this (as you mention in your question) is to characterize the categorical variable by various other variables in which searching for possible splits is feasible.

$\endgroup$
3
  • $\begingroup$ thank you for the clarification. I see now that it is a matter of feasibility. I hope someday a short cut is discovered or a different approach is developed to use lmer trees to assess larger numbers of possible splits. $\endgroup$
    – Miguel
    Commented Nov 8, 2021 at 12:14
  • $\begingroup$ I would propose to accept the answer in this case because it describes what the underlying algorithm does. Along for a new algorithm is beyond the scope of this question IMO. $\endgroup$ Commented Nov 8, 2021 at 18:52
  • $\begingroup$ I do think the answer explains well how the algorithm works and its computational limitations. However, I think it is still too soon to call it a definitive answer (only 3 days have passed). Other people that have not stop by yet may want to share their insights as well. I will accept your answer by the end of the week if no one has added anything different by then. $\endgroup$
    – Miguel
    Commented Nov 9, 2021 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.