Skip to content

Commit 2778b4d

Browse files
committed
fix(shrinkBins): sum the squared differences not square the sum
for targeted shrinkage
1 parent 36d7045 commit 2778b4d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

R/shrinkBins.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ shrinkBins <- function(
140140
c <- sd(x[targets])
141141
} else {
142142
## targeted shrinkage
143-
c <- 1 - ((length(x) - 3) * (sd(x[targets])^2) / sum(x - grand.mean)^2)
143+
c <- 1 - ((length(x) - 3) * (sd(x[targets])^2) / sum((x - grand.mean)^2))
144144
}
145145

146146
return(grand.mean + c * (x - grand.mean))

0 commit comments

Comments
 (0)