You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: vignettes/introduction.Rmd
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -78,9 +78,9 @@ packageVersion("ptable")
78
78
```
79
79
80
80
81
-
### E1. Minimal Parameter Setting and Computation of the Transition Probabilities
81
+
### Minimal Parameter Setting and Computation of the Transition Probabilities
82
82
83
-
#### E1.1 Minimal Parameter Setting
83
+
#### Minimal Parameter Setting
84
84
```{r}
85
85
# note: all parameters except for maximum noise D and variance V have default values
86
86
params <- pt_create_pParams(D=2, V=1)
@@ -94,7 +94,7 @@ The minimum set of parameters that have to be specified are:
94
94
95
95
The result of the above function is an object of class "ptable_params", that contains all information necessary for the computation of the perturbation probabilities.
96
96
97
-
#### E1.2 Computation of the Transition Probabilities
97
+
#### Computation of the Transition Probabilities
98
98
99
99
Once the parameters are set, the probabilities can be computed running:
100
100
```{r}
@@ -115,7 +115,7 @@ The most relevant and important slots of the object are:
115
115
-`pParams`: The input parameters that result from the preceding function `pt_create_pParams()`.
116
116
-`empResults`: A data frame for output checking of the constraints.
117
117
118
-
#### E1.2.1. The Transition Matrix
118
+
#### The Transition Matrix
119
119
Let's have a look at the transition matrix (i.e. at the slot `@pMatrix`) of the object `ptable_destatis`:
120
120
121
121
```{r}
@@ -129,7 +129,7 @@ diag(ptable_destatis@pMatrix)
129
129
```
130
130
The main diagonal shows the preservation probabilities. These are the probabilities that the original frequencies remain unchanged. In this instance, the probability that an original frequency 2 remains unchanged is `r diag(ptable_destatis@pMatrix)[2+1]`.
131
131
132
-
#### E1.2.2. Symmetry - and what does it mean in the context of perturbation tables?
132
+
#### Symmetry - and what does it mean in the context of perturbation tables?
133
133
134
134
As you may have recognized, the transition matrix has a finite number of rows (that represent original frequency counts) and columns (that represent the target frequency counts).
Given this symmetry, the transition matrix can be displayed in the reduced form. There is no need to define more rows than up to the case of symmetry. The number of columns is then defined by: *number of rows + maximum noise D + `js`*.
169
+
Given this symmetry, the transition matrix can be displayed in the reduced form. There is no need to define more rows than up to the case of symmetry.
170
170
171
-
#### E1.2.3. Output Checking and Troubleshooting
171
+
#### Output Checking and Troubleshooting
172
172
Next, we will check the empirical results that can be used for troubleshooting:
173
173
174
174
```{r}
@@ -203,7 +203,7 @@ ptable_destatis_new@pMatrix
203
203
The goal of the following subsections is to create perturbation tables with extended and afterwards with advanced parameter settings of the function `pt_create_pParams()`.
204
204
205
205
206
-
### E2. Extended Parameter Setting
206
+
### Extended Parameter Setting
207
207
208
208
The remaining parameters (among others `js` and `pstay`), are set to default if not specified:
209
209
@@ -213,7 +213,7 @@ The remaining parameters (among others `js` and `pstay`), are set to default if
213
213
214
214
However, let's change and modify them with respect to our needs:
215
215
216
-
#### E2.1 Setting the probability of an original frequency to remain unperturbed
216
+
#### Setting the probability of an original frequency to remain unperturbed
217
217
218
218
```{r}
219
219
# note: once again, check the diagonal entries
@@ -228,7 +228,7 @@ The probability of an original frequency to remain unperturbed (i.e. that the ta
228
228
229
229
**Important note regarding "*false positives*":** Zeroes will not be perturbed to positive frequency counts since unbiasedness is a main characteristic of the cell-key based method.^[If *false positives* are an important part of a protection concept, we recommend to use (targeted record swapping)[https://github.com/sdcTools/protoTestCensus/tree/master/TargetedRecordSwapping] as protection method (alone, or in combination with CKM, as proposed by the SGA "Harmonised protection of census data in the ESS".]
230
230
231
-
#### E2.2 Do not allow for positive cell values equal to or below a specified threshold value
231
+
#### Do not allow for positive cell values equal to or below a specified threshold value
232
232
233
233
```{r}
234
234
# note: ptable::pt_create_pTable(...) could also be used as input for argument "pTable"
@@ -244,7 +244,7 @@ Since the threshold value `js` is set to 2, we do not allow target frequencies 1
244
244
Further parameters of the function `pt_create_pParams()` are explained in the help page that can be accessed by calling `?pt_create_pParams()`.
245
245
246
246
247
-
### E3. Advanced Parameter Setting
247
+
### Advanced Parameter Setting
248
248
249
249
Several parameters of the function `pt_create_pParams()` that we have learned so far, can also be assigned to each original positive frequency count separately using the vector notation in R.
250
250
@@ -358,7 +358,7 @@ fifi_plot(result, type="d")
358
358
```
359
359
360
360
361
-
Alternatively, we would can change the monotony condition for i=1:
361
+
Alternatively, we can change the monotony condition for i=1:
0 commit comments