Skip to content

Commit 32d61d5

Browse files
committed
Change the return statement of bootstrap.replication to return the mean of the partition means (instead of the sum)
1 parent 5845582 commit 32d61d5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

R/mechanism-bootstrap.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ bootstrap.replication <- function(x, n, sensitivity, epsilon, fun, inputObject,
3434
stat.partitions[[i]] <- currentPartition * stat.currentPartition + noise.currentPartition
3535
}
3636
stat.out <- do.call(rbind, stat.partitions)
37-
return(apply(stat.out, 2, sum))
37+
# return(apply(stat.out, 2, sum))
38+
# returnedBootstrappedResult = apply(stat.out, 2, sum)
39+
returnedBootstrappedResult = apply(X = stat.out, MARGIN = 2, FUN = fun)
40+
return(returnedBootstrappedResult)
3841
}
3942

4043
# 2: treat it as a partition with a mean of 0 and keep it in the calculation, adding noise and adding it to the final calculation
@@ -52,7 +55,7 @@ bootstrap.replication <- function(x, n, sensitivity, epsilon, fun, inputObject,
5255
# for (i in 1:max.appearances) {
5356
# variance.i <- (i * probs[i] * (sensitivity^2)) / (2 * epsilon)
5457
# if (i %in% validPartitions) {
55-
# stat.i <- fun(x[partition == i])
58+
# stat.i <- inputObject$bootStatEval(x[partition == currentPartition], fun, ...)
5659
# noise.i <- dpNoise(n=length(stat.i), scale=sqrt(variance.i), dist='gaussian')
5760
# stat.partitions[[i]] <- i * stat.i + noise.i
5861
# } else {

0 commit comments

Comments
 (0)