rtreemultivariate-testingparty

is it posible to fit a multivariate linear model using lmtree?


I want to fit a lmtree where the response is multivariable. You know that you can fit a Multivariate Multiple Regression using lm function as follows:

lm(cbind(Y1, Y2) ~ X1+X2+X3, data = my_df)

so I tried to do this in the context of lmtree:

lmtree(cbind(Y1,Y2) ~ Z1 | X1+X2+X3,data = my_df)

but it seems it is not implemented, I got this error message:

Error in x[, !is.na(z$coefficients), drop = FALSE] : 
  (subscript) logical subscript too long

It is possible to fit a lmtree with a multivariable response? if so, what is the correct way to specify it?


Solution

  • Currently, lmtree() is only geared towards univariate response variables and multivariate responses are not supported.

    In principle, the MOB approach can also be used for multivariate linear models, though. Using the partykit:::lmfit() function as a starting point would also work but:

    If there are no other problems which require adaptation of the code, then it might also be possible to wire this into lmtree() but I haven't got the time to check this now.