round3 {dembase} | R Documentation

## Randomly round a dataset to base 3.

### Description

Confidentialise counts data by randomly rounding it to multiples of three.

### Usage

    round3(object)

    ## S4 method for signature 'Counts'
    round3(object)

    ## S4 method for signature 'Values'
    round3(object)

    ## S4 method for signature 'array'
    round3(object)

    ## S4 method for signature 'numeric'
    round3(object)

### Arguments

`object` | An object of class `DemographicArray`, an ordinary array, or a numeric vector.

### Details

Randomly rounding to base three is a popular confidentialisation technique at statistical agencies. It only works with data consisting entirely of integers, though negative integers are allows.

A value is rounded as follows:

- If the value is divisible by 3, leave it unchanged.

- If there is a remainder of 1 after dividing by 3, round down (ie subtract 1) with probability 2/3, and round up (ie add 2) with probability 1/3.

- If there is a remainder of 2 after dividing by 3, round down (ie subtract 2) with probability 1/3, and round up (ie add 1) with probability 2/3.

Missing values are permitted, and are left unchanged.

### Value

An object with the same class as `object`.

### Examples

    x <- CountsOne(0:10, labels = letters[1:11], name = "region")
    round3(x)
    round3(x)

[Package dembase version 0.0.0.119 Index]