data.examples.Rd
Example data frames. Allow to run R code contained in the ‘Examples’ section of the ReGenesees package help pages.
data(data.examples)
The main data frame, named example
, contains (artificial) data from a two stage stratified cluster sampling design. The sample is made up of 3000 final units, for which the following 21 variables were observed:
towcod
Code identifying "variance PSUs": towns (PSUs) in not-self-representing (NSR) strata, families (SSUs) in self-representing (SR) strata, numeric
famcod
Code identifying families (SSUs), numeric
key
Key identifying final units (individuals), numeric
weight
Initial weights, numeric
stratum
Stratification variable, factor
with levels 801
802
803
901
902
903
904
905
906
907
908
1001
1002
1003
1004
1005
1006
1007
1008
1009
1101
1102
1103
1104
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3101
3102
3103
3104
3105
3106
3107
3108
3201
3202
3203
3204
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5501
5502
5503
5504
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
SUPERSTRATUM
Collapsed strata variable (eliminates lonely PSUs), factor
with levels 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
sr
Strata type, integer
with values 0
(NSR strata) and 1
(SR strata)
regcod
Code identifying regions, factor
with levels 6
7
10
procod
Code identifying provinces, factor
with levels 8
9
10
11
30
31
32
54
55
93
x1
Indicator variable (integer), numeric
x2
Indicator variable (integer), numeric
x3
Indicator variable (integer), numeric
y1
Indicator variable (integer), numeric
y2
Indicator variable (integer), numeric
y3
Indicator variable (integer), numeric
age5c
Age variable with 5 classes, factor
with levels 1
2
3
4
5
age10c
Age variable with 10 classes, factor
with levels 1
2
3
4
5
6
7
8
9
10
sex
Sex variable, factor
with levels f
m
marstat
Marital status variable, factor
with levels married
unmarried
widowed
z
A continuous quantitative variable, numeric
income
Income variable, numeric
Objects pop01
, ..., pop07pp
contain known population totals for various calibration models. Object pairs with names differing in the 'p
' suffix (such as pop03
and pop03p
) refer to the same calibration problem but pertain to different solution methods (global and partitioned respectively, see e.calibrate
). The two-component numeric vector bounds
expresses a possible choice for the allowed range for the ratios between calibrated weights and direct weights in the aforementioned calibration problems.
Data in the example
data frame are artificial. The structure of example
intentionally resembles the one of typical household survey data, but the values it stores are unreliable. The only purpose of such data is that they can be fruitfully exploited to illustrate the syntax and the working mechanism of the functions provided by the ReGenesees package.
#> towcod famcod key weight stratum SUPERSTRATUM sr regcod procod x1 x2 x3 y1 y2 #> 1 147 3103 1 485.8 803 26 0 7 8 0 0 0 0 0 #> 2 147 3103 2 485.8 803 26 0 7 8 0 0 0 1 1 #> 3 147 3109 3 485.8 803 26 0 7 8 0 0 0 1 1 #> 4 147 3111 4 485.8 803 26 0 7 8 0 0 0 0 0 #> 5 147 3120 5 485.8 803 26 0 7 8 0 0 1 1 1 #> 6 147 3121 6 485.8 803 26 0 7 8 0 0 0 0 0 #> y3 age5c age10c sex marstat z income #> 1 0 3 5 f unmarried 148.32432 1158 #> 2 0 2 4 f married 88.57746 1268 #> 3 0 3 6 f married 115.07377 108 #> 4 0 4 7 f married 86.37647 1700 #> 5 0 2 4 f married 110.52172 537 #> 6 0 3 5 f married 134.40092 2143str(example)#> 'data.frame': 3000 obs. of 21 variables: #> $ towcod : int 147 147 147 147 147 147 147 147 147 147 ... #> $ famcod : int 3103 3103 3109 3111 3120 3121 3123 3123 3123 3124 ... #> $ key : int 1 2 3 4 5 6 7 8 9 10 ... #> $ weight : num 486 486 486 486 486 ... #> $ stratum : Factor w/ 80 levels "801","802","803",..: 3 3 3 3 3 3 3 3 3 3 ... #> $ SUPERSTRATUM: Factor w/ 55 levels "1","2","3","4",..: 26 26 26 26 26 26 26 26 26 26 ... #> $ sr : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... #> $ regcod : Factor w/ 3 levels "6","7","10": 2 2 2 2 2 2 2 2 2 2 ... #> $ procod : Factor w/ 10 levels "8","9","10","11",..: 1 1 1 1 1 1 1 1 1 1 ... #> $ x1 : int 0 0 0 0 0 0 0 0 0 0 ... #> $ x2 : int 0 0 0 0 0 0 0 0 0 0 ... #> $ x3 : int 0 0 0 0 1 0 0 0 0 0 ... #> $ y1 : int 0 1 1 0 1 0 1 0 0 1 ... #> $ y2 : int 0 1 1 0 1 0 1 0 0 1 ... #> $ y3 : int 0 0 0 0 0 0 0 0 0 0 ... #> $ age5c : Factor w/ 5 levels "1","2","3","4",..: 3 2 3 4 2 3 1 2 2 3 ... #> $ age10c : Factor w/ 10 levels "1","2","3","4",..: 5 4 6 7 4 5 1 4 4 5 ... #> $ sex : Factor w/ 2 levels "f","m": 1 1 1 1 1 1 2 2 2 1 ... #> $ marstat : Factor w/ 3 levels "married","unmarried",..: 2 1 1 1 1 1 2 1 1 1 ... #> $ z : num 148.3 88.6 115.1 86.4 110.5 ... #> $ income : num 1158 1268 108 1700 537 ...