Skip to contents

Calculates and plots tables of utility measures. The calculations of utility measures are done by the function utility.tab. Options are all one-way tables, all two-way tables or three-way tables for a specified third variable along with pairs of all other variables.

This function can be also used with synthetic data NOT created by syn(), but then an additional parameters not.synthesised and cont.na might need to be provided.

Usage

# S3 method for synds
utility.tables(object, data,
               tables = "twoway", maxtables = 5e4,
               vars = NULL, third.var = NULL,
               useNA = TRUE, ngroups = 5,
               tab.stats = c("pMSE", "S_pMSE", "df"),
               plot.stat = "S_pMSE", plot = TRUE,
               print.tabs = FALSE, digits.tabs = 4,
               max.scale = NULL, min.scale = 0, plot.title = NULL,
               nworst = 5, ntabstoprint = 0, k.syn = FALSE,
               low = "grey92", high = "#E41A1C",
               n.breaks = NULL, breaks = NULL, ...)

# S3 method for data.frame
utility.tables(object, data,
               cont.na = NULL, not.synthesised = NULL,
               tables = "twoway", maxtables = 5e4,
               vars = NULL, third.var = NULL,
               useNA = TRUE, ngroups = 5,
               tab.stats = c("pMSE", "S_pMSE", "df"),
               plot.stat = "S_pMSE", plot = TRUE,
               print.tabs = FALSE, digits.tabs = 4,
               max.scale = NULL, min.scale = 0, plot.title = NULL,
               nworst = 5, ntabstoprint = 0, k.syn = FALSE,
               low = "grey92", high = "#E41A1C",
               n.breaks = NULL, breaks = NULL, ...)

# S3 method for list
utility.tables(object, data,
               cont.na = NULL, not.synthesised = NULL,
               tables = "twoway", maxtables = 5e4,
               vars = NULL, third.var = NULL,
               useNA = TRUE, ngroups = 5,
               tab.stats = c("pMSE", "S_pMSE", "df"),
               plot.stat = "S_pMSE", plot = TRUE,
               print.tabs = FALSE, digits.tabs = 4,
               max.scale = NULL, min.scale = 0, plot.title = NULL,
               nworst = 5, ntabstoprint = 0, k.syn = FALSE,
               low = "grey92", high = "#E41A1C",
               n.breaks = NULL, breaks = NULL, ...)

# S3 method for utility.tables
print(x, print.tabs = NULL, digits.tabs = NULL,
      plot = NULL, plot.title = NULL, max.scale = NULL, min.scale = NULL,
      nworst = NULL, ntabstoprint = NULL, ...)

Arguments

object

an object of class synds, which stands for 'synthesised data set'. It is typically created by function syn() and it includes object$m synthesised data set(s) as object$syn. This a single data set when object$m = 1 or a list of length object$m when object$m > 1. Alternatively, when data are synthesised not using syn(), it can be a data frame with a synthetic data set or a list of data frames with synthetic data sets, all created from the same original data with the same variables and the same method.

data

the original (observed) data set.

cont.na

a named list of codes for missing values for continuous variables if different from the R missing data code NA. The names of the list elements must correspond to the variables names for which the missing data codes need to be specified.

not.synthesised

a vector of variable names for any variables that has been left unchanged in the synthetic data.

tables

defines the type of tables to produce. Options are "oneway", "twoway" (default) or "threeway". If set to "oneway" or "twoway" all possible tables from vars are produced. For "threeway", third.var may be specified and all three-way tables between this variable and other pairs of variables are produced. If a third variable is not specified the function chooses the variable with the largest median utility measure for all three-way tables it contributes to.

maxtables

maximum number of tables that will be produced. If number of tables is larger, then utility is only measured for a sample of size maxtables. You cannot produce plots of twoway or three way tables from sampled tables

.

vars

a vector of strings with the names of variables to be used to form the table, or a vector of variable numbers in the original data. Defaults to all variables in both original and synthetic data.

third.var

when tables is "threeway" a variable to make the third variable with all other pairs

useNA

determines if NA values are to be included in tables. Only applies for method "tab".

ngroups

if numerical (non-factor) variables included with method = "tab" will be classified into this number of groups to form tables. Classification is performed using classIntervals() function for n = ngroups. By default, style = "quantile", to get appropriate groups for skewed data. Problems for variables with a small number of unique values are handled by selecting only unique values of breaks. Arguments of classIntervals() may be, however, specified in the call to utility.tables().

tab.stats

statistics to include in the table of results. Must be a selection from: "VW", "FT","JSD", "SPECKS", "WMabsDD", "U", "G", "pMSE", "PO50", "MabsDD", "dBhatt", "S_VW", "S_FT", "S_JSD", "S_WMabsDD", "S_G", "S_pMSE", "df", dfG. If tab.stats = "all", all of these will be included. See utility.tab for explanations of measures.

plot.stat

statistics to plot. Choice is "VW", "FT", "JSD", "SPECKS", "WMabsDD", "U", "G", "pMSE", "PO50", "MabsDD", "dBhatt", "S_VW", "S_FT", "S_JSD", "S_WMabsDD", "S_G", "S_pMSE". See utility.tab for explanations of measures.

plot

determines if plot will be produced when the result is printed.

print.tabs

logical value that determines if table of results is to be printed.

digits.tabs

number of digits to print for table, except for p-values that are always printed to 4 places.

max.scale

a numeric value for the maximum value used in calculating the shading of the plots. If it is NULL then the maximum value will be replaced by the maximum value in the data.

min.scale

a numeric value for the minimum value used in calculating the shading of the plots. If it is NULL then the minimum value will be replaced by zero.

plot.title

title for the plot.

nworst

a number of variable combinations with worst utility scores to be printed.

ntabstoprint

a number of tables to print for observed and synthetic data with the worst utility.

k.syn

a logical indicator as to whether the sample size itself has been synthesised.

low

colour for low end of the gradient.

high

colour for high end of the gradient.

n.breaks

a number of break points to create if breaks are not given directly.

breaks

breaks for a two colour binned gradient.

...

additional parameters

x

an object of class utility.tables.

Details

Calculates tables of observed and synthesised values for the variables specified in vars with the function utility.tab and produces tables and plots of one-way, two-way or three-way utility measures formed from vars. Several options for utility measures can be selected for printing or plotting. Details are in help file for utility.tab.

The tables and variables with the worst utility scores are identified. Visualisations of the matrices of utility scores are plotted. For threeway tables a third variable can be defined to select all tables involving that variable for plotting. If it is not specified the variable with tables giving the worst utility is selected as the third variable.

Value

An object of class utility.tab which is a list with the following components:

tabs

a table with all the selected measures for all combinations of variables defined by tables, third.var, and vars.

plot.stat

measure used in mat and toplot.

tables

see above.

third.var

see above.

utility.plot

plot of the selected utility measure.

var.scores

an average of utility scores for all combinations with other variables.

plot

see above.

print.tabs

see above.

digits.tabs

see above.

plot.title

see above.

max.scale

see above.

min.scale

see above.

ntabstoprint

see above.

nworst

see above.

worstn

variable combinations with nworst worst utility scores.

worsttabs

observed and synthetic cross-tabulations for worstn.

References

Read, T.R.C. and Cressie, N.A.C. (1988) Goodness--of--Fit Statistics for Discrete Multivariate Data, Springer--Verlag, New York.

Voas, D. and Williamson, P. (2001) Evaluating goodness-of-fit measures for synthetic microdata. Geographical and Environmental Modelling, 5(2), 177-200.

See also

Examples

ods <- SD2011[1:1000, c("sex", "age", "edu", "marital", "region", "income")]
s1 <- syn(ods)
#> 
#> Synthesis
#> -----------
#>  sex age edu marital region income

### synthetic data provided as a 'synds' object
(t1 <- utility.tables(s1, ods, tab.stats = "all", print.tabs = TRUE))
#> 
#> Two-way utility: S_pMSE value plotted for 15 pairs of variables.
#> 
#> Variable combinations with worst 5 utility scores (S_pMSE):
#>    3.edu:4.marital     3.edu:6.income 4.marital:6.income        1.sex:3.edu 
#>             2.4250             2.2399             2.0515             1.7562 
#>  5.region:6.income 
#>             1.6795 

#> 
#> Table of selected utility measures
#>                          VW       FT    JSD SPECKS  WMabsDD        U        G
#> 1.sex:2.age         13.5480  13.5825 0.0024  0.046  11.5552 530749.5  13.8765
#> 1.sex:3.edu         14.0495  16.0694 0.0027  0.047  11.7750 531365.0  12.0713
#> 1.sex:4.marital     12.4275  12.4657 0.0022  0.049  13.0011 529537.5  12.5492
#> 1.sex:5.region      18.9728  19.1397 0.0034  0.049  23.7869 535973.5  18.6950
#> 1.sex:6.income       9.3742   9.3881 0.0017  0.039  10.8971 526724.0   9.4378
#> 2.age:3.edu         27.0988  29.1940 0.0050  0.066  23.5977 545009.0  24.8808
#> 2.age:4.marital     25.0989  35.2240 0.0052  0.048  24.8629 533018.0  15.7710
#> 2.age:5.region      79.5641  85.1280 0.0148  0.106  79.9712 576764.0  75.1965
#> 2.age:6.income      38.1826  38.7985 0.0070  0.062  26.9316 548473.5  37.9247
#> 3.edu:4.marital     63.0497  84.9123 0.0130  0.068  43.6769 550932.5  45.7973
#> 3.edu:5.region      74.8008  81.5838 0.0140  0.108  70.7818 574630.0  67.9978
#> 3.edu:6.income      53.7586  56.2707 0.0099  0.092  38.5360 563655.5  52.7679
#> 4.marital:5.region 121.4061 173.2982 0.0257  0.098  92.9615 577352.0  72.6354
#> 4.marital:6.income  75.9072 116.4769 0.0165  0.075  57.6446 556993.5  36.2427
#> 5.region:6.income  159.5497 171.3872 0.0299  0.156 124.7286 610671.0 162.9952
#>                      pMSE PO50 MabsDD dBhatt   S_VW   S_FT  S_JSD S_WMabsDD
#> 1.sex:2.age        0.0008 2.30  0.092 0.0412 1.5053 1.5092 1.5692    1.2839
#> 1.sex:3.edu        0.0009 2.35  0.094 0.0448 1.7562 2.0087 1.9299    1.4719
#> 1.sex:4.marital    0.0008 2.45  0.098 0.0395 1.1298 1.1332 1.1781    1.1819
#> 1.sex:5.region     0.0012 2.45  0.098 0.0489 0.6120 0.6174 0.6406    0.7673
#> 1.sex:6.income     0.0006 1.95  0.078 0.0343 0.8522 0.8535 0.8877    0.9906
#> 2.age:3.edu        0.0017 3.30  0.132 0.0604 1.3549 1.4597 1.4536    1.1799
#> 2.age:4.marital    0.0016 2.40  0.096 0.0664 0.9653 1.3548 1.1625    0.9563
#> 2.age:5.region     0.0050 5.30  0.212 0.1032 1.0071 1.0776 1.0819    1.0123
#> 2.age:6.income     0.0024 3.10  0.124 0.0696 1.3166 1.3379 1.3848    0.9287
#> 3.edu:4.marital    0.0039 3.40  0.136 0.1030 2.4250 3.2659 2.8810    1.6799
#> 3.edu:5.region     0.0047 5.40  0.216 0.1010 1.1688 1.2747 1.2624    1.1060
#> 3.edu:6.income     0.0034 4.60  0.184 0.0839 2.2399 2.3446 2.3793    1.6057
#> 4.marital:5.region 0.0076 4.90  0.196 0.1472 1.6187 2.3106 1.9762    1.2395
#> 4.marital:6.income 0.0047 3.75  0.150 0.1207 2.0515 3.1480 2.5802    1.5580
#> 5.region:6.income  0.0100 7.80  0.312 0.1464 1.6795 1.8041 1.8144    1.3129
#>                       S_G S_pMSE df dfG
#> 1.sex:2.age        1.5418 1.5053  9   9
#> 1.sex:3.edu        1.7245 1.7562  8   7
#> 1.sex:4.marital    1.1408 1.1298 11  11
#> 1.sex:5.region     0.6031 0.6120 31  31
#> 1.sex:6.income     0.8580 0.8522 11  11
#> 2.age:3.edu        1.3095 1.3549 20  19
#> 2.age:4.marital    0.6857 0.9653 26  23
#> 2.age:5.region     0.9641 1.0071 79  78
#> 2.age:6.income     1.3077 1.3166 29  29
#> 3.edu:4.marital    2.5443 2.4250 26  18
#> 3.edu:5.region     1.0967 1.1688 64  62
#> 3.edu:6.income     2.2943 2.2399 24  23
#> 4.marital:5.region 1.1907 1.6187 75  61
#> 4.marital:6.income 1.5101 2.0515 37  24
#> 5.region:6.income  1.7340 1.6795 95  94
### synthetic data provided as a 'data.frame' object
(t1 <- utility.tables(s1$syn, ods, tab.stats = "all", print.tabs = TRUE))
#> 
#> Two-way utility: S_pMSE value plotted for 15 pairs of variables.
#> 
#> Variable combinations with worst 5 utility scores (S_pMSE):
#>    3.edu:4.marital     3.edu:6.income 4.marital:6.income        1.sex:3.edu 
#>             2.4250             2.2399             2.0515             1.7562 
#>  5.region:6.income 
#>             1.6795 

#> 
#> Table of selected utility measures
#>                          VW       FT    JSD SPECKS  WMabsDD        U        G
#> 1.sex:2.age         13.5480  13.5825 0.0024  0.046  11.5552 530749.5  13.8765
#> 1.sex:3.edu         14.0495  16.0694 0.0027  0.047  11.7750 531365.0  12.0713
#> 1.sex:4.marital     12.4275  12.4657 0.0022  0.049  13.0011 529537.5  12.5492
#> 1.sex:5.region      18.9728  19.1397 0.0034  0.049  23.7869 535973.5  18.6950
#> 1.sex:6.income       9.3742   9.3881 0.0017  0.039  10.8971 526724.0   9.4378
#> 2.age:3.edu         27.0988  29.1940 0.0050  0.066  23.5977 545009.0  24.8808
#> 2.age:4.marital     25.0989  35.2240 0.0052  0.048  24.8629 533018.0  15.7710
#> 2.age:5.region      79.5641  85.1280 0.0148  0.106  79.9712 576764.0  75.1965
#> 2.age:6.income      38.1826  38.7985 0.0070  0.062  26.9316 548473.5  37.9247
#> 3.edu:4.marital     63.0497  84.9123 0.0130  0.068  43.6769 550932.5  45.7973
#> 3.edu:5.region      74.8008  81.5838 0.0140  0.108  70.7818 574630.0  67.9978
#> 3.edu:6.income      53.7586  56.2707 0.0099  0.092  38.5360 563655.5  52.7679
#> 4.marital:5.region 121.4061 173.2982 0.0257  0.098  92.9615 577352.0  72.6354
#> 4.marital:6.income  75.9072 116.4769 0.0165  0.075  57.6446 556993.5  36.2427
#> 5.region:6.income  159.5497 171.3872 0.0299  0.156 124.7286 610671.0 162.9952
#>                      pMSE PO50 MabsDD dBhatt   S_VW   S_FT  S_JSD S_WMabsDD
#> 1.sex:2.age        0.0008 2.30  0.092 0.0412 1.5053 1.5092 1.5692    1.2839
#> 1.sex:3.edu        0.0009 2.35  0.094 0.0448 1.7562 2.0087 1.9299    1.4719
#> 1.sex:4.marital    0.0008 2.45  0.098 0.0395 1.1298 1.1332 1.1781    1.1819
#> 1.sex:5.region     0.0012 2.45  0.098 0.0489 0.6120 0.6174 0.6406    0.7673
#> 1.sex:6.income     0.0006 1.95  0.078 0.0343 0.8522 0.8535 0.8877    0.9906
#> 2.age:3.edu        0.0017 3.30  0.132 0.0604 1.3549 1.4597 1.4536    1.1799
#> 2.age:4.marital    0.0016 2.40  0.096 0.0664 0.9653 1.3548 1.1625    0.9563
#> 2.age:5.region     0.0050 5.30  0.212 0.1032 1.0071 1.0776 1.0819    1.0123
#> 2.age:6.income     0.0024 3.10  0.124 0.0696 1.3166 1.3379 1.3848    0.9287
#> 3.edu:4.marital    0.0039 3.40  0.136 0.1030 2.4250 3.2659 2.8810    1.6799
#> 3.edu:5.region     0.0047 5.40  0.216 0.1010 1.1688 1.2747 1.2624    1.1060
#> 3.edu:6.income     0.0034 4.60  0.184 0.0839 2.2399 2.3446 2.3793    1.6057
#> 4.marital:5.region 0.0076 4.90  0.196 0.1472 1.6187 2.3106 1.9762    1.2395
#> 4.marital:6.income 0.0047 3.75  0.150 0.1207 2.0515 3.1480 2.5802    1.5580
#> 5.region:6.income  0.0100 7.80  0.312 0.1464 1.6795 1.8041 1.8144    1.3129
#>                       S_G S_pMSE df dfG
#> 1.sex:2.age        1.5418 1.5053  9   9
#> 1.sex:3.edu        1.7245 1.7562  8   7
#> 1.sex:4.marital    1.1408 1.1298 11  11
#> 1.sex:5.region     0.6031 0.6120 31  31
#> 1.sex:6.income     0.8580 0.8522 11  11
#> 2.age:3.edu        1.3095 1.3549 20  19
#> 2.age:4.marital    0.6857 0.9653 26  23
#> 2.age:5.region     0.9641 1.0071 79  78
#> 2.age:6.income     1.3077 1.3166 29  29
#> 3.edu:4.marital    2.5443 2.4250 26  18
#> 3.edu:5.region     1.0967 1.1688 64  62
#> 3.edu:6.income     2.2943 2.2399 24  23
#> 4.marital:5.region 1.1907 1.6187 75  61
#> 4.marital:6.income 1.5101 2.0515 37  24
#> 5.region:6.income  1.7340 1.6795 95  94

t2 <- utility.tables(s1, ods, tables = "twoway")
print(t2, max.scale = 3)
#> 
#> Two-way utility: S_pMSE value plotted for 15 pairs of variables.
#> 
#> Variable combinations with worst 5 utility scores (S_pMSE):
#>    3.edu:4.marital     3.edu:6.income 4.marital:6.income        1.sex:3.edu 
#>             2.4250             2.2399             2.0515             1.7562 
#>  5.region:6.income 
#>             1.6795 

#> 
#> Medians and maxima of selected utility measures for all tables compared
#>        Medians Maxima
#> pMSE    0.0024  0.010
#> S_pMSE  1.3549  2.425
#> df     26.0000 95.000
#> 
#> For more details of all scores use print.tabs = TRUE.

(t3 <- utility.tables(s1, ods, tab.stats = "all", tables = "threeway",
                      third.var = "sex", print.tabs = TRUE))
#> 
#> Three-way utility (total of 20 variable combinations):
#> 
#> Average of 3-way scores S_pMSE (ordered) for 3-way tables including each variable.
#>  6.income 4.marital     3.edu     1.sex  5.region     2.age 
#>  1.745562  1.740576  1.710200  1.601466  1.527327  1.517667 
#> 
#> Variable with highest average score, 1.sex, selected to make plots.
#> To see others, set parameter 'third.var'.
#> 
#> Variable combinations with worst 5 utility scores (S_pMSE):
#>       1.sex:3.edu:4.marital    3.edu:4.marital:6.income 
#>                      2.3545                      2.1137 
#>    1.sex:4.marital:6.income 4.marital:5.region:6.income 
#>                      1.9452                      1.8418 
#>     3.edu:5.region:6.income 
#>                      1.7870 

#> 
#> Table of selected utility measures
#>                                   VW        FT    JSD SPECKS  WMabsDD        U
#> 1.sex:2.age:3.edu            68.3580   71.5137 0.0126  0.103  53.7091 570300.0
#> 1.sex:2.age:4.marital        53.1420   63.8290 0.0104  0.084  48.5232 558238.0
#> 1.sex:2.age:5.region        195.1775  229.3586 0.0379  0.166 174.4574 619620.5
#> 1.sex:2.age:6.income         87.8049   94.0331 0.0164  0.113  73.3394 579764.0
#> 1.sex:3.edu:4.marital       101.2454  133.7126 0.0207  0.098  72.7155 573042.0
#> 1.sex:3.edu:5.region        161.7050  195.9694 0.0318  0.148 143.3987 606034.0
#> 1.sex:3.edu:6.income         72.9249   75.8103 0.0134  0.103  59.2648 575087.5
#> 1.sex:4.marital:5.region    200.8421  292.2690 0.0428  0.143 161.5521 608351.5
#> 1.sex:4.marital:6.income    118.6581  169.0391 0.0250  0.108  90.3779 580484.0
#> 1.sex:5.region:6.income     310.2146  400.4684 0.0630  0.195 233.9749 646743.0
#> 2.age:3.edu:4.marital       141.0044  204.0796 0.0300  0.120 117.1309 587121.5
#> 2.age:3.edu:5.region        377.2141  529.1660 0.0792  0.219 323.7140 662232.0
#> 2.age:3.edu:6.income        200.1727  244.7140 0.0395  0.165 150.7779 619389.5
#> 2.age:4.marital:5.region    333.5551  535.0839 0.0744  0.182 286.6636 642096.0
#> 2.age:4.marital:6.income    201.5031  296.0390 0.0433  0.131 153.7463 603605.0
#> 2.age:5.region:6.income     661.4622 1046.0735 0.1470  0.292 519.9739 719518.0
#> 3.edu:4.marital:5.region    364.9517  571.8842 0.0806  0.200 303.4234 653140.5
#> 3.edu:4.marital:6.income    230.3936  332.1226 0.0489  0.161 174.7419 620119.5
#> 3.edu:5.region:6.income     596.8706  920.4195 0.1310  0.284 463.4376 709316.0
#> 4.marital:5.region:6.income 567.2758  897.4909 0.1261  0.261 438.4289 699108.5
#>                                    G   pMSE  PO50 MabsDD dBhatt   S_VW   S_FT
#> 1.sex:2.age:3.edu            65.4975 0.0043  5.15  0.206 0.0945 1.7090 1.7878
#> 1.sex:2.age:4.marital        45.0136 0.0033  4.20  0.168 0.0893 1.2359 1.4844
#> 1.sex:2.age:5.region        172.5799 0.0122  8.30  0.332 0.1693 1.2511 1.4702
#> 1.sex:2.age:6.income         88.1187 0.0055  5.65  0.226 0.1084 1.4882 1.5938
#> 1.sex:3.edu:4.marital        81.8634 0.0063  4.90  0.196 0.1293 2.3545 3.1096
#> 1.sex:3.edu:5.region        133.0191 0.0101  7.40  0.296 0.1565 1.2633 1.5310
#> 1.sex:3.edu:6.income         73.4145 0.0046  5.15  0.206 0.0973 1.5516 1.6130
#> 1.sex:4.marital:5.region    114.3982 0.0126  7.15  0.286 0.1911 1.5569 2.2657
#> 1.sex:4.marital:6.income     76.2070 0.0074  5.40  0.216 0.1454 1.9452 2.7711
#> 1.sex:5.region:6.income     269.4928 0.0194  9.75  0.390 0.2237 1.6589 2.1415
#> 2.age:3.edu:4.marital        86.0023 0.0088  6.00  0.240 0.1597 1.6589 2.4009
#> 2.age:3.edu:5.region        247.2862 0.0236 10.95  0.438 0.2572 1.3329 1.8698
#> 2.age:3.edu:6.income        167.3600 0.0125  8.25  0.330 0.1749 1.7714 2.1656
#> 2.age:4.marital:5.region    142.5463 0.0208  9.10  0.364 0.2586 1.4316 2.2965
#> 2.age:4.marital:6.income    123.7217 0.0126  6.55  0.262 0.1924 1.7077 2.5088
#> 2.age:5.region:6.income     322.4693 0.0413 14.60  0.584 0.3616 1.5901 2.5146
#> 3.edu:4.marital:5.region    171.8409 0.0228 10.00  0.400 0.2674 1.5596 2.4439
#> 3.edu:4.marital:6.income    144.1979 0.0144  8.05  0.322 0.2038 2.1137 3.0470
#> 3.edu:5.region:6.income     318.6324 0.0373 14.20  0.568 0.3392 1.7870 2.7557
#> 4.marital:5.region:6.income 290.6975 0.0355 13.05  0.522 0.3349 1.8418 2.9139
#>                              S_JSD S_WMabsDD    S_G S_pMSE  df dfG
#> 1.sex:2.age:3.edu           1.8183    1.3427 1.6794 1.7090  40  39
#> 1.sex:2.age:4.marital       1.3905    1.1284 1.1542 1.2359  43  39
#> 1.sex:2.age:5.region        1.4010    1.1183 1.1354 1.2511 156 152
#> 1.sex:2.age:6.income        1.6016    1.2430 1.5193 1.4882  59  58
#> 1.sex:3.edu:4.marital       2.7802    1.6911 2.5582 2.3545  43  32
#> 1.sex:3.edu:5.region        1.4315    1.1203 1.1178 1.2633 128 119
#> 1.sex:3.edu:6.income        1.6448    1.2610 1.5960 1.5516  47  46
#> 1.sex:4.marital:5.region    1.9161    1.2523 1.1327 1.5569 129 101
#> 1.sex:4.marital:6.income    2.3670    1.4816 1.7320 1.9452  61  44
#> 1.sex:5.region:6.income     1.9453    1.2512 1.5760 1.6589 187 171
#> 2.age:3.edu:4.marital       2.0344    1.3780 1.4099 1.6589  85  61
#> 2.age:3.edu:5.region        1.6160    1.1439 1.0568 1.3329 283 234
#> 2.age:3.edu:6.income        2.0178    1.3343 1.6092 1.7714 113 104
#> 2.age:4.marital:5.region    1.8438    1.2303 0.9138 1.4316 233 156
#> 2.age:4.marital:6.income    2.1174    1.3029 1.4555 1.7077 118  85
#> 2.age:5.region:6.income     2.0393    1.2499 1.0470 1.5901 416 308
#> 3.edu:4.marital:5.region    1.9865    1.2967 1.1015 1.5596 234 156
#> 3.edu:4.marital:6.income    2.5891    1.6031 1.9226 2.1137 109  75
#> 3.edu:5.region:6.income     2.2631    1.3875 1.3221 1.7870 334 241
#> 4.marital:5.region:6.income 2.3631    1.4235 1.4984 1.8418 308 194

(t4 <- utility.tables(s1, ods, tab.stats = "all", tables = "threeway",
                      third.var = "sex", useNA = FALSE, print.tabs = TRUE))
#> 
#> Three-way utility (total of 20 variable combinations):
#> 
#> Average of 3-way scores S_pMSE (ordered) for 3-way tables including each variable.
#> 4.marital  6.income     3.edu     1.sex  5.region     2.age 
#>  1.718703  1.704867  1.703099  1.564257  1.530968  1.522167 
#> 
#> Variable with highest average score, 1.sex, selected to make plots.
#> To see others, set parameter 'third.var'.
#> 
#> Variable combinations with worst 5 utility scores (S_pMSE):
#>       1.sex:3.edu:4.marital    3.edu:4.marital:6.income 
#>                      2.4481                      2.0832 
#> 4.marital:5.region:6.income     3.edu:5.region:6.income 
#>                      1.8844                      1.8363 
#>    2.age:4.marital:6.income 
#>                      1.8001 

#> 
#> Table of selected utility measures
#>                                   VW       FT    JSD SPECKS  WMabsDD        U
#> 1.sex:2.age:3.edu            66.3902  67.5465 0.0121 0.1025  51.9261 569300.0
#> 1.sex:2.age:4.marital        52.4480  63.1101 0.0103 0.0837  47.4480 554075.0
#> 1.sex:2.age:5.region        195.1775 229.3586 0.0379 0.1660 174.4574 619620.5
#> 1.sex:2.age:6.income         71.9020  73.5852 0.0154 0.1153  61.0153 427964.0
#> 1.sex:3.edu:4.marital        90.5788 113.0263 0.0182 0.0954  62.8299 566048.0
#> 1.sex:3.edu:5.region        159.7839 192.0645 0.0313 0.1476 141.6757 605034.0
#> 1.sex:3.edu:6.income         55.9873  56.5803 0.0119 0.1008  47.1509 421758.0
#> 1.sex:4.marital:5.region    186.7474 264.1354 0.0395 0.1401 150.2122 601363.5
#> 1.sex:4.marital:6.income     70.4039  93.6665 0.0169 0.0935  61.1195 416374.5
#> 1.sex:5.region:6.income     262.4193 342.1608 0.0625 0.1916 195.1360 475579.5
#> 2.age:3.edu:4.marital       129.0044 180.0796 0.0271 0.1175 106.4962 580017.0
#> 2.age:3.edu:5.region        375.4010 525.4278 0.0788 0.2186 322.1180 661232.0
#> 2.age:3.edu:6.income        159.8386 183.3835 0.0359 0.1639 122.1902 455104.5
#> 2.age:4.marital:5.region    319.3939 506.8285 0.0712 0.1793 274.2918 635108.0
#> 2.age:4.marital:6.income    172.8107 242.9802 0.0427 0.1388 126.7859 444452.5
#> 2.age:5.region:6.income     563.1238 888.1617 0.1459 0.2917 443.3098 530350.0
#> 3.edu:4.marital:5.region    348.9517 539.8842 0.0769 0.1968 289.2438 645156.5
#> 3.edu:4.marital:6.income    179.1593 244.4541 0.0435 0.1558 134.8367 450361.0
#> 3.edu:5.region:6.income     503.1467 760.5998 0.1277 0.2863 388.5716 522378.5
#> 4.marital:5.region:6.income 489.9494 769.4582 0.1273 0.2663 377.9903 513431.0
#>                                    G   pMSE    PO50 MabsDD dBhatt   S_VW   S_FT
#> 1.sex:2.age:3.edu            65.4975 0.0041  5.1276 0.2049 0.0919 1.7023 1.7320
#> 1.sex:2.age:4.marital        44.2499 0.0033  4.1897 0.1673 0.0890 1.3112 1.5778
#> 1.sex:2.age:5.region        172.5799 0.0122  8.3000 0.3320 0.1693 1.2511 1.4702
#> 1.sex:2.age:6.income         74.8773 0.0052  5.7625 0.2305 0.1036 1.4674 1.5017
#> 1.sex:3.edu:4.marital        81.2607 0.0057  4.7691 0.1908 0.1191 2.4481 3.0548
#> 1.sex:3.edu:5.region        133.0191 0.0100  7.3787 0.2951 0.1549 1.2581 1.5123
#> 1.sex:3.edu:6.income         57.2584 0.0041  5.0379 0.2016 0.0908 1.4733 1.4890
#> 1.sex:4.marital:5.region    114.3982 0.0117  6.9995 0.2801 0.1821 1.5183 2.1474
#> 1.sex:4.marital:6.income     50.3129 0.0052  4.6464 0.1869 0.1172 1.5305 2.0362
#> 1.sex:5.region:6.income     225.9267 0.0191  9.5460 0.3832 0.2234 1.6822 2.1933
#> 2.age:3.edu:4.marital        86.0023 0.0081  5.8735 0.2349 0.1503 1.6539 2.3087
#> 2.age:3.edu:5.region        247.2862 0.0235 10.9305 0.4373 0.2563 1.3312 1.8632
#> 2.age:3.edu:6.income        146.1639 0.0117  8.1829 0.3277 0.1635 1.7004 1.9509
#> 2.age:4.marital:5.region    142.5463 0.0200  8.9563 0.3585 0.2522 1.4132 2.2426
#> 2.age:4.marital:6.income    118.9872 0.0127  6.9258 0.2777 0.1887 1.8001 2.5310
#> 2.age:5.region:6.income     275.3497 0.0411 14.5518 0.5834 0.3599 1.5907 2.5089
#> 3.edu:4.marital:5.region    171.8409 0.0219  9.8394 0.3936 0.2603 1.5440 2.3889
#> 3.edu:4.marital:6.income    128.4875 0.0131  7.7778 0.3117 0.1893 2.0832 2.8425
#> 3.edu:5.region:6.income     286.5560 0.0367 14.2982 0.5725 0.3331 1.8363 2.7759
#> 4.marital:5.region:6.income 260.0205 0.0359 13.2963 0.5327 0.3358 1.8844 2.9595
#>                              S_JSD S_WMabsDD    S_G S_pMSE  df dfG
#> 1.sex:2.age:3.edu           1.7909    1.3314 1.6794 1.7023  39  39
#> 1.sex:2.age:4.marital       1.4771    1.1862 1.2292 1.3112  40  36
#> 1.sex:2.age:5.region        1.4010    1.1183 1.1354 1.2511 156 152
#> 1.sex:2.age:6.income        1.5540    1.2452 1.5281 1.4674  49  49
#> 1.sex:3.edu:4.marital       2.8220    1.6981 2.6213 2.4481  37  31
#> 1.sex:3.edu:5.region        1.4200    1.1156 1.1178 1.2581 127 119
#> 1.sex:3.edu:6.income        1.5467    1.2408 1.5068 1.4733  38  38
#> 1.sex:4.marital:5.region    1.8455    1.2212 1.1327 1.5183 123 101
#> 1.sex:4.marital:6.income    1.8094    1.3287 1.3240 1.5305  46  38
#> 1.sex:5.region:6.income     1.9870    1.2509 1.5799 1.6822 156 143
#> 2.age:3.edu:4.marital       1.9950    1.3653 1.4334 1.6539  78  60
#> 2.age:3.edu:5.region        1.6114    1.1423 1.0568 1.3312 282 234
#> 2.age:3.edu:6.income        1.8899    1.2999 1.6423 1.7004  94  89
#> 2.age:4.marital:5.region    1.8116    1.2137 0.9138 1.4132 226 156
#> 2.age:4.marital:6.income    2.1955    1.3207 1.6079 1.8001  96  74
#> 2.age:5.region:6.income     2.0426    1.2523 1.0391 1.5907 354 265
#> 3.edu:4.marital:5.region    1.9547    1.2798 1.1015 1.5440 226 156
#> 3.edu:4.marital:6.income    2.4963    1.5679 1.9468 2.0832  86  66
#> 3.edu:5.region:6.income     2.3084    1.4181 1.4186 1.8363 274 202
#> 4.marital:5.region:6.income 2.4169    1.4538 1.5759 1.8844 260 165

(t5 <- utility.tables(s1, ods,  tab.stats = "all",
                      print.tabs = TRUE))
#> 
#> Two-way utility: S_pMSE value plotted for 15 pairs of variables.
#> 
#> Variable combinations with worst 5 utility scores (S_pMSE):
#>    3.edu:4.marital     3.edu:6.income 4.marital:6.income        1.sex:3.edu 
#>             2.4250             2.2399             2.0515             1.7562 
#>  5.region:6.income 
#>             1.6795 

#> 
#> Table of selected utility measures
#>                          VW       FT    JSD SPECKS  WMabsDD        U        G
#> 1.sex:2.age         13.5480  13.5825 0.0024  0.046  11.5552 530749.5  13.8765
#> 1.sex:3.edu         14.0495  16.0694 0.0027  0.047  11.7750 531365.0  12.0713
#> 1.sex:4.marital     12.4275  12.4657 0.0022  0.049  13.0011 529537.5  12.5492
#> 1.sex:5.region      18.9728  19.1397 0.0034  0.049  23.7869 535973.5  18.6950
#> 1.sex:6.income       9.3742   9.3881 0.0017  0.039  10.8971 526724.0   9.4378
#> 2.age:3.edu         27.0988  29.1940 0.0050  0.066  23.5977 545009.0  24.8808
#> 2.age:4.marital     25.0989  35.2240 0.0052  0.048  24.8629 533018.0  15.7710
#> 2.age:5.region      79.5641  85.1280 0.0148  0.106  79.9712 576764.0  75.1965
#> 2.age:6.income      38.1826  38.7985 0.0070  0.062  26.9316 548473.5  37.9247
#> 3.edu:4.marital     63.0497  84.9123 0.0130  0.068  43.6769 550932.5  45.7973
#> 3.edu:5.region      74.8008  81.5838 0.0140  0.108  70.7818 574630.0  67.9978
#> 3.edu:6.income      53.7586  56.2707 0.0099  0.092  38.5360 563655.5  52.7679
#> 4.marital:5.region 121.4061 173.2982 0.0257  0.098  92.9615 577352.0  72.6354
#> 4.marital:6.income  75.9072 116.4769 0.0165  0.075  57.6446 556993.5  36.2427
#> 5.region:6.income  159.5497 171.3872 0.0299  0.156 124.7286 610671.0 162.9952
#>                      pMSE PO50 MabsDD dBhatt   S_VW   S_FT  S_JSD S_WMabsDD
#> 1.sex:2.age        0.0008 2.30  0.092 0.0412 1.5053 1.5092 1.5692    1.2839
#> 1.sex:3.edu        0.0009 2.35  0.094 0.0448 1.7562 2.0087 1.9299    1.4719
#> 1.sex:4.marital    0.0008 2.45  0.098 0.0395 1.1298 1.1332 1.1781    1.1819
#> 1.sex:5.region     0.0012 2.45  0.098 0.0489 0.6120 0.6174 0.6406    0.7673
#> 1.sex:6.income     0.0006 1.95  0.078 0.0343 0.8522 0.8535 0.8877    0.9906
#> 2.age:3.edu        0.0017 3.30  0.132 0.0604 1.3549 1.4597 1.4536    1.1799
#> 2.age:4.marital    0.0016 2.40  0.096 0.0664 0.9653 1.3548 1.1625    0.9563
#> 2.age:5.region     0.0050 5.30  0.212 0.1032 1.0071 1.0776 1.0819    1.0123
#> 2.age:6.income     0.0024 3.10  0.124 0.0696 1.3166 1.3379 1.3848    0.9287
#> 3.edu:4.marital    0.0039 3.40  0.136 0.1030 2.4250 3.2659 2.8810    1.6799
#> 3.edu:5.region     0.0047 5.40  0.216 0.1010 1.1688 1.2747 1.2624    1.1060
#> 3.edu:6.income     0.0034 4.60  0.184 0.0839 2.2399 2.3446 2.3793    1.6057
#> 4.marital:5.region 0.0076 4.90  0.196 0.1472 1.6187 2.3106 1.9762    1.2395
#> 4.marital:6.income 0.0047 3.75  0.150 0.1207 2.0515 3.1480 2.5802    1.5580
#> 5.region:6.income  0.0100 7.80  0.312 0.1464 1.6795 1.8041 1.8144    1.3129
#>                       S_G S_pMSE df dfG
#> 1.sex:2.age        1.5418 1.5053  9   9
#> 1.sex:3.edu        1.7245 1.7562  8   7
#> 1.sex:4.marital    1.1408 1.1298 11  11
#> 1.sex:5.region     0.6031 0.6120 31  31
#> 1.sex:6.income     0.8580 0.8522 11  11
#> 2.age:3.edu        1.3095 1.3549 20  19
#> 2.age:4.marital    0.6857 0.9653 26  23
#> 2.age:5.region     0.9641 1.0071 79  78
#> 2.age:6.income     1.3077 1.3166 29  29
#> 3.edu:4.marital    2.5443 2.4250 26  18
#> 3.edu:5.region     1.0967 1.1688 64  62
#> 3.edu:6.income     2.2943 2.2399 24  23
#> 4.marital:5.region 1.1907 1.6187 75  61
#> 4.marital:6.income 1.5101 2.0515 37  24
#> 5.region:6.income  1.7340 1.6795 95  94