[R] "Too many elements specified" error when mob command is used

Bodea, Tudor D gtg757i at mail.gatech.edu
Wed Apr 8 05:38:50 CEST 2009

Dear R users:

I try to model-based recursive partition a dataset (~3,500 records) using the mob function from the party package (many thanks to Achim Zeileis, Torsten Hothorn, Kurt Hornik and all other contributors for this wonderful tool).  In this dataset, I have two related categorical variables, say S1 and S2, with a level of S1 corresponding to at least a level of S2.  For example, level A of S1 may correspond to levels A1, A2, A3, and A4 of S2.  In total, S1 has 10 levels with a minimum of 4 and a maximum of 1881 records per level.  Similarly, S2 has 30 levels with a minimum of 4 and a maximum of 994 records per level.  In this context, when mob is called with S1 as the segmenting variable a very reasonable output is produced. Unfortunately, when mob is called with S2 as the segmenting variable, an error, that I can not explain (given the size of my dataset), is displayed.  Has anyone experienced a similar problem before?  If so, are there any reasonable ways to fix it?  For your conveniece, the comamnd (without the corresponding dataset), the error, and the characteristics of my system are attached below.  Thank you so much.


> res5_unadj <- mob(T_Product7 ~ P_Product7 | S2, data=data7, model=linearModel, control=mob_control(minsplit = 4))
Error in matrix(0, nrow = mi, ncol = nl) : too many elements specified

R 2.8.1 on Windows XP, 2x2.2GHz, 1GB of RAM

More information about the R-help mailing list