Skip to contents

Produces summaries of the synthesised variables. When more than one synthetic data set has been generated (object$m > 1), by default summaries are calculated by averaging summary values for all synthetic data copies (see msel argument).

Usage

# S3 method for synds
summary(object, msel = NULL, maxsum = 7,
  digits = max(3, getOption("digits")-3), ...)

# S3 method for summary.synds
print(x, ...)

Arguments

object

an object of class synds; a result of a call to syn.

msel

index or indices of synthetic data copies for which a summary is desired. If NULL (default) summaries are calculated by averaging summary values for all synthetic data copies.

maxsum

integer, indicating how many levels should be shown for factors.

digits

integer, used for number formatting with format.

...

additional arguments passed to summary.

x

an object of class summary.synds.

Details

See summary for more details.

Value

An object of class summary.synds, which is a list with the following components:

m

the number of synthetic versions of the original (observed) data.

msel

index or indices of synthetic data copies for which a summary is produced. If NULL summaries are calculated by averaging summary values for all synthetic data copies.

method

a vector of synthesising methods applied to each variable in the saved synthesised data.

result

a table or a list of tabels (if more than one synthetic data set is selected) with summaries of synthesised variables.

References

Nowok, B., Raab, G.M and Dibben, C. (2016). synthpop: Bespoke creation of synthetic data in R. Journal of Statistical Software, 74(11), 1-26. doi:10.18637/jss.v074.i11 .

See also

Examples

s1 <- syn(SD2011[,c("sex","age","edu","marital")], m = 3)
#> 
#> Synthesis number 1
#> --------------------
#>  sex age edu marital
#> 
#> Synthesis number 2
#> --------------------
#>  sex age edu marital
#> 
#> Synthesis number 3
#> --------------------
#>  sex age edu marital
summary(s1)
#> Synthetic object with 3 syntheses using methods:
#>      sex      age      edu  marital 
#> "sample"   "cart"   "cart"   "cart" 
#> 
#> Summary (average) for all synthetic data sets:
#>      sex            age                              edu        
#>  MALE  :2219   Min.   :16.00   PRIMARY/NO EDUCATION    : 955.3  
#>  FEMALE:2781   1st Qu.:32.33   VOCATIONAL/GRAMMAR      :1599.3  
#>                Median :49.00   SECONDARY               :1487.7  
#>                Mean   :47.89   POST-SECONDARY OR HIGHER: 949.7  
#>                3rd Qu.:61.33   NA's                    :   8.0  
#>                Max.   :95.00                                    
#>                                                                 
#>                marital        
#>  SINGLE            :1224.000  
#>  MARRIED           :3016.333  
#>  WIDOWED           : 524.667  
#>  DIVORCED          : 195.000  
#>  LEGALLY SEPARATED :   4.667  
#>  DE FACTO SEPARATED:  25.000  
#>  NA's              :  10.333  
summary(s1, msel = c(1,3))
#> Synthetic object with 3 syntheses using methods:
#>      sex      age      edu  marital 
#> "sample"   "cart"   "cart"   "cart" 
#> 
#> Summary for synthetic data set 1:
#>      sex            age                              edu      
#>  MALE  :2202   Min.   :16.00   PRIMARY/NO EDUCATION    : 943  
#>  FEMALE:2798   1st Qu.:32.00   VOCATIONAL/GRAMMAR      :1563  
#>                Median :49.00   SECONDARY               :1493  
#>                Mean   :47.91   POST-SECONDARY OR HIGHER: 991  
#>                3rd Qu.:61.00   NA's                    :  10  
#>                Max.   :97.00                                  
#>                                                               
#>                marital    
#>  SINGLE            :1236  
#>  MARRIED           :3004  
#>  WIDOWED           : 521  
#>  DIVORCED          : 194  
#>  LEGALLY SEPARATED :   8  
#>  DE FACTO SEPARATED:  30  
#>  NA's              :   7  
#> 
#> Summary for synthetic data set 3:
#>      sex            age                             edu      
#>  MALE  :2224   Min.   :16.0   PRIMARY/NO EDUCATION    : 929  
#>  FEMALE:2776   1st Qu.:32.0   VOCATIONAL/GRAMMAR      :1674  
#>                Median :49.0   SECONDARY               :1476  
#>                Mean   :47.7   POST-SECONDARY OR HIGHER: 918  
#>                3rd Qu.:61.0   NA's                    :   3  
#>                Max.   :92.0                                  
#>                                                              
#>                marital    
#>  SINGLE            :1224  
#>  MARRIED           :3028  
#>  WIDOWED           : 510  
#>  DIVORCED          : 199  
#>  LEGALLY SEPARATED :   2  
#>  DE FACTO SEPARATED:  21  
#>  NA's              :  16