# bssBYcut: Between group SS for 'y', for all possible splits on values... In gamclass: Functions and Data for a Course on Modern Regression and Classification

## Description

Each point of separation between successve values of `x` is used in turn to create two groups of observations. The between group sum of squares for `y` is calculated for each such split.

## Usage

 `1` ```bssBYcut(x, y, data) ```

## Arguments

 `x` Variable (numeric) used to define splits. Observations with `x` values less than the cut point go into the first group, while those with values `>=` the cut point go into the second group. `y` Variable for which BSS values are to be calculated. `data` Data frame with columns `x` and `y`.

## Value

Data frame with columns:

 `xOrd` Cut points for splits. `comp2 ` Between groups sum of squares

J H Maindonald

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23``` ```xy <- bssBYcut(weight, height, women) with(xy, xy[which.max(bss), ]) ## The function is currently defined as function (x, y, data) { xnam <- deparse(substitute(x)) ynam <- deparse(substitute(y)) xv <- data[, xnam] yv <- data[, ynam] sumss <- function(x, y, cut) { av <- mean(y) left <- x < cut sum(left) * (mean(y[left]) - av)^2 + sum(!left) * (mean(y[!left]) - av)^2 } xOrd <- unique(sort(xv))[-1] bss <- numeric(length(xOrd)) for (i in 1:length(xOrd)) { bss[i] <- sumss(xv, yv, xOrd[i]) } list(xOrd = xOrd, bss = bss) } ```

gamclass documentation built on Nov. 14, 2020, 1:07 a.m.