Question: When choosing each split, recursively, in a regression tree, I understand that you want to measure the *spread*, in each side of the split, essentially.

So, in some sources, including this one at 6 minutes into the [video](https://www.youtube.com/watch?v=_RxqyvRK0Rw), I see that a different form of variance is used, except the sum of squared residuals of each region is not divided by the number of points.

[![form of variance not divided by the number of points](https://i.stack.imgur.com/HkwD1.png)](https://i.stack.imgur.com/HkwD1.png) 

Is this a typical metric to use for determining where to split? A similar question [here](https://stats.stackexchange.com/questions/85470/how-to-split-nodes-in-regression-trees) also shows the same equation. 

I'm wondering why we don't divide each term by the number of points in each region, i.e. left and right of the split?

That way, the splits would get more credit for reducing the variance of MANY points in a single region, rather than weighting the error of each region the same, regardless of the number of points?

**EDIT:** I suppose a broader and more important question is why is the number of points in each region not considered when computing error in each left and right region of the split? I haven't found an error metric that takes the number of points into account.

Answer: 
First off, let me just say that there are *plenty* of metrics that could be used to determine a split in the Regression Tree (that's an altogether different question) but the criterion you mentioned--minimizing the sum of squares--is definitely the most popular.

With respect to your second question (i.e. why we don't divide by the number of points in a region), here is an example that might give insight into the potential problems related to splitting based on the minimum sum of variances:

```
library(MASS)
data(Boston)

tss <- function(x){
    if (length(x) == 0){
        return(0)
    }
    sum((x-mean(x))^2)
}

ss <- tss(Boston$medv)
new.ss <- ss
which.s <- NA

for (i in Boston$lstat){
        mask <- Boston$lstat <= i
        new.y1 <- Boston$medv[mask]
        new.y2 <- Boston$medv[!mask]
    temp.ss <- tss(new.y1) + tss(new.y2)
    if (temp.ss < new.ss){
        new.ss <- temp.ss
        which.s <- i
    }
}

plot(medv ~ lstat, data=Boston, col=ifelse(Boston$lstat < which.s, 'red', 'darkblue'))

```

Now, try switching `sum` to `mean` in the `tss` function and re-run this entire block of code. Notice how different the resulting plot is?
It's an old question but the reason I can think of is as follows:
We don't divide each term by the number of points in each region because while performing the split, we are not interested in average deviance instead we are interested in the absolute deviance; thus, a larger set of observations will usually have a larger deviance than a smaller set in the same situation.