<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/partially-additive-generalized-linear-model-trees/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://eeecon.uibk.ac.at/~zeileis/news/palmtree/"> Achim Zeileis</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>The PALM tree algorithm for partially additive (generalized) linear model trees is introduced along with the R package palmtree. One potential application is modeling of treatment-subgroup interactions while adjusting for global additive effects.</p>
<h2>Citation</h2>
<p>Heidi Seibold, Torsten Hothorn, Achim Zeileis (2018). “Generalised Linear Model Trees with Global Additive Effects.” <em>Advances in Data Analysis and Classification</em>. Forthcoming. <a rel="nofollow" href="https://doi.org/10.1007/s11634-018-0342-1" target="_blank">doi:10.1007/s11634-018-0342-1</a> <a rel="nofollow" href="http://arxiv.org/abs/1612.07498" target="_blank">arXiv</a></p>
<h2>Abstract</h2>
<p>Model-based trees are used to find subgroups in data which differ with respect to model parameters. In some applications it is natural to keep some parameters fixed globally for all observations while asking if and how other parameters vary across subgroups. Existing implementations of model-based trees can only deal with the scenario where all parameters depend on the subgroups. We propose partially additive linear model trees (PALM trees) as an extension of (generalised) linear model trees (LM and GLM trees, respectively), in which the model parameters are specified a priori to be estimated either globally from all observations or locally from the observations within the subgroups determined by the tree. Simulations show that the method has high power for detecting subgroups in the presence of global effects and reliably recovers the true parameters. Furthermore, treatment-subgroup differences are detected in an empirical application of the method to data from a mathematics exam: the PALM tree is able to detect a small subgroup of students that had a disadvantage in an exam with two versions while adjusting for overall ability effects.</p>
<h2>Software</h2>
<p><a rel="nofollow" href="https://cran.r-project.org/package=palmtree" target="_blank">https://CRAN.R-project.org/package=palmtree</a></p>
<h2>Illustration: Treatment differences in mathematics exam</h2>
<p>PALM trees are employed to investigate treatment differences in a mathematics 101 exam (for first-year business and economics students) at Universität Innsbruck. Due to limited availability of seats in the exam room, students could self-select into one of two exam tracks that were conducted back to back with slightly different questions on the same topics. The question is whether this “treatment” of splitting the students into two tracks was fair in the sense that it is on average equally difficult for the two groups. To investigate the question the data are loaded from the <a rel="nofollow" href="https://cran.r-project.org/package=psychotools" target="_blank">psychotools</a> package, points are scaled to achieved percent in [0, 100], and the subset of variables for the analysis are selected:</p>
<pre><code>data(&quot;MathExam14W&quot;, package = &quot;psychotools&quot;)
MathExam14W$tests &lt;- 100 * MathExam14W$tests/26
MathExam14W$pcorrect &lt;- 100 * MathExam14W$nsolved/13
MathExam &lt;- MathExam14W[ , c(&quot;pcorrect&quot;, &quot;group&quot;, &quot;tests&quot;, &quot;study&quot;,
  &quot;attempt&quot;, &quot;semester&quot;, &quot;gender&quot;)]
</code></pre>
<p>A naive check could be whether the percentage of correct points (<code>pcorrect</code>) differs between the two <code>group</code>s:</p>
<pre><code>ci &lt;- function(object) cbind(&quot;Coefficient&quot; = coef(object), confint(object))
ci(lm(pcorrect ~ group, data = MathExam))
##             Coefficient 2.5 % 97.5 %
## (Intercept)       57.60  55.1  60.08
## group2            -2.33  -5.7   1.03
</code></pre>
<p>This shows that the second group achieved on average 2.33 percentage points less than the first group. But the corresponding confidence interval conveys that this difference is not significant.</p>
<p>However, it is conceivable that stronger (or weaker) students selected themselves more into one of the two groups. And if the assignment had been random, then the “treatment effect” might have been larger or even smaller. Luckily, an independent measure of the students’ ability is available, namely the percentage of points achieved in the online <code>tests</code> conducted during the semester prior to the exam. Adjusting for that increases the treatment effect to a decrease of 4.37 percentage points which is still non-significant, though. This is due to weaker students self-selecting into the second group. Moreover, the <code>tests</code> coefficient signals that 1 more percentage point from the online tests lead on average to 0.855 more percentage points in the written exam.</p>
<pre><code>ci(lm(pcorrect ~ group + tests, data = MathExam))
##             Coefficient   2.5 % 97.5 %
## (Intercept)      -5.846 -13.521  1.828
## group2           -4.366  -7.231 -1.502
## tests             0.855   0.756  0.955
</code></pre>
<p>Finally, PALM trees are used to assess whether there are subgroups of differential <code>group</code> treatment effects when adjusting for a global additive <code>tests</code> effect. Potential subgroups can be formed from the covariates <code>tests</code>, type of <code>study</code> (three-year bachelor vs. four-year diploma), the number of times the students <code>attempt</code>ed the exam, number of <code>semester</code>s, and <code>gender</code>. Using <a rel="nofollow" href="https://cran.r-project.org/package=palmtree" target="_blank">palmtree</a> this can be easily carried out:</p>
<pre><code>library(&quot;palmtree&quot;)
palmtree_math &lt;- palmtree(pcorrect ~ group | tests | tests +
  study + attempt + semester + gender, data = MathExam)
print(palmtree_math)
## Partially additive linear model tree
## 
## Model formula:
## pcorrect ~ group | tests + study + attempt + semester + gender
## 
## Fitted party:
## [1] root
## |   [2] attempt &lt;= 1
## |   |   [3] tests &lt;= 92.3: n = 352
## |   |       (Intercept)      group2 
## |   |             -7.09       -3.00 
## |   |   [4] tests > 92.3: n = 79
## |   |       (Intercept)      group2 
## |   |              14.0       -14.5 
## |   [5] attempt > 1: n = 298
## |       (Intercept)      group2 
## |              2.33       -1.70 
## 
## Number of inner nodes:    2
## Number of terminal nodes: 3
## Number of parameters per node: 2
## Objective function (residual sum of squares): 253218
## 
## Linear fixed effects (from palm model):
## tests 
## 0.787 
</code></pre>
<p>A somewhat enhanced version of <code>plot(palmtree_math)</code> is shown below:</p>
<p><a rel="nofollow" href="https://i0.wp.com/eeecon.uibk.ac.at/~zeileis/assets/posts/2018-10-08-palmtree/palmtree-math.png?ssl=1" target="_blank"><img alt="PALM tree for mathematics exam data" src="https://i0.wp.com/eeecon.uibk.ac.at/~zeileis/assets/posts/2018-10-08-palmtree/palmtree-math.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p>This indicates that for most students the <code>group</code> treatment effect is indeed negligible. However, for the subgroup of “good” students (with high percentage correct in the online tests) in the first attempt, the exam in the second group was indeed more difficult. On average the students in the second group obtained -14.5 percentage points less than in the first group.</p>
<pre><code>ci(palmtree_math$palm)
##               Coefficient   2.5 % 97.5 %
## (Intercept)        -7.088 -16.148  1.971
## .tree4             21.069  13.348 28.791
## .tree5              9.421   5.168 13.673
## tests               0.787   0.671  0.903
## .tree3:group2      -2.997  -6.971  0.976
## .tree4:group2     -14.494 -22.921 -6.068
## .tree5:group2      -1.704  -5.965  2.557
</code></pre>
<p>The absolute size of this group difference is still moderate, though, corresponding to about half an exercise out of 13.</p>
<h2>Simulation study</h2>
<p>In addition to the empirical case study the manuscript also provides an extensive simulation study comparing the performance of PALM trees in treatment-subgroup scenarios to standard linear model (LM) trees, optimal treatment regime (OTR) trees (following Zhang et al. 2012), and the STIMA algorithm (simultaneous threshold interaction modeling algorithm). The study evaluates the methods with respect to (1) finding the correct subgroups, (2) not splitting when there are no subgroups, (3) finding the optimal treatment regime, and (4) correctly estimating the treatment effect.</p>
<p>Here we just briefly highlight the results for question (1): Are the correct subgroups found?<br>
The figure below shows the mean number of subgroups (over 150 simulated data sets and mean adjusted rand index (ARI) for increasing treatment effect<br>
differences Δ<sub>β</sub> and number of observations n.</p>
<p><a rel="nofollow" href="https://i2.wp.com/eeecon.uibk.ac.at/~zeileis/assets/posts/2018-10-08-palmtree/palmtree-sim.png?ssl=1" target="_blank"><img alt="Simulation results" src="https://i2.wp.com/eeecon.uibk.ac.at/~zeileis/assets/posts/2018-10-08-palmtree/palmtree-sim.png?w=456&ssl=1" data-recalc-dims="1"></a></p>
<p>This shows that PALM trees perform increasingly well and somewhat better with respect to these metrics than the competitors. More details on the different scenarios and corresponding evaluations can be found in the manuscript. More replication materials are provided along with the manuscript on the publisher’s web page.</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://eeecon.uibk.ac.at/~zeileis/news/palmtree/"> Achim Zeileis</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/UN-UaFVSjNs" height="1"></a></div>