I am using the R partykit package to do recursive partitioning of linear regression models and am having trouble understanding how I should expect observation weights to affect the parameter instability tests that are used to determine which variable to split on. A key point of confusion is why the scale of the weights alone is affecting the tests. For example, suppose we are working with some sort of consumer product and we want to weight observations by sales volumes so that products with very low volume do not get alot of weight. I would not expect that I would have to worry about defining the sales in thousands vs. millions (the relative weight is not affected). However, in the code example below, changing the scale of the weight argument to lmtree() scales the test statistic from the parameter instability test up or down by the same amount, with the p-value also changing.


n <- 500
TT <- 12
dat <- rbind(
  data.table(tt=rep(1:TT, n), x1=rep(runif(n), each=TT), weight=1)
dat[x1<=0.5, y := 0.1*TT+rnorm(.N)]
dat[x1>.5, y := 0.2*TT + rnorm(.N)]

tree <- lmtree(y ~ tt | x1, data=dat, weight=weight/10, verbose=T, maxdepth=2)

1 Answer 1


The lmtree() function as well as the the underlying mob() function distinguish weights being used as case weights (default) or proportionality weights. In the former case, the number of observations is the sum of weights. This is useful for not repeating exactly identical observations. In the latter case, it is the number of non-zero weights which is the way weights are usually employed in lm().

To control which type of weights should be used set caseweights = TRUE (default) or caseweights = FALSE. See ?mob_control.

  • 1
    $\begingroup$ Thanks @Achim. When caseweights=FALSE the number of observations indeed does not change with the scale of the weight variable. However, the test statistic for the parameter instability test gets scaled, implying that the decision whether to split the data is still dependent on the scale of the proportionality weights, which seems counter intuitive. Can you comment? $\endgroup$
    – Abiel
    Dec 18, 2017 at 14:16
  • $\begingroup$ Which partykit version is this? I couldn't replicate the problem... $\endgroup$ Dec 18, 2017 at 14:31
  • $\begingroup$ Good point, I was using the development version 1.2 from sometime in September, I downgraded to 1.1-1 and now there is no problem. I see the build status for 1.2 on r-forge right now is "failed to build", I'll try again with that when it next becomes available. $\endgroup$
    – Abiel
    Dec 18, 2017 at 14:56
  • $\begingroup$ @Abiel, thanks for the pointer. Incidentally, Torsten released version 1.2-0 to CRAN yesterday which apparently has a bug in the handling of proportionality weights. Will fix as soon as possible... but I'm not sure if I'm going to make it this year. ;-) Meanwhile please use 1.1-x. $\endgroup$ Dec 19, 2017 at 6:56

Your Answer

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

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