R/bssBYcut.R

Defines functions bssBYcut

Documented in bssBYcut

bssBYcut <-
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])
  }
data.frame(xOrd=xOrd, bss=bss)
 }

Try the gamclass package in your browser

Any scripts or data that you put into this service are public.

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