Skip to contents

Fits multinomial models to the synthesised data set(s) using the multinom function.

Usage

multinom.synds(formula, data,  ...)

Arguments

formula

a symbolic description of the model to be estimated. A typical model has the form response ~ predictors. See the documentation of multinom and formula for details.

data

an object of class synds, which stands for 'synthesised data set'. It is typically created by function syn and it includes data$m synthesised data set(s).

...

additional parameters passed to multinom.

Value

To print the results the print function (print.fit.synds) can be used. The summary function (summary.fit.synds) can be used to obtain the combined results of models fitted to each of the

m synthetic data sets.

An object of class fit.synds. It is a list with the following components:

call

the original call to multinom.synds.

mcoefavg

combined (average) coefficient estimates.

mvaravg

combined (average) variance estimates of mcoef.

analyses

an object summarising the fit to each synthetic data set or a list of m such objects. Note that this is different from the object created by summary.multinom to make it compatible with other fitting methods. In particular the coefficients are vectors, not matrices.

fitting.function

function used to fit the model.

n

a number of cases in the original data.

k

a number of cases in the synthesised data.

proper

a logical value indicating whether synthetic data were generated using proper synthesis.

m

the number of synthetic versions of the observed data.

method

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

incomplete

a logical value indicating whether the dependent variable in the model was not synthesised.

mcoef

a matrix of coefficients estimates from all m syntheses.

mvar

a matrix of variance estimates from all m syntheses.

Examples

ods <- SD2011[1:1000, c("sex", "age", "edu", "marital", "ls", "smoke")]
s1 <- syn(ods, m = 3)
#> 
#> Synthesis number 1
#> --------------------
#>  sex age edu marital ls smoke
#> 
#> Synthesis number 2
#> --------------------
#>  sex age edu marital ls smoke
#> 
#> Synthesis number 3
#> --------------------
#>  sex age edu marital ls smoke
f1 <- multinom.synds(edu  ~ sex + age, data = s1)
#> # weights:  16 (9 variable)
#> initial  value 1383.521772 
#> iter  10 value 1248.143077
#> final  value 1233.707146 
#> converged
#> # weights:  16 (9 variable)
#> initial  value 1384.908067 
#> iter  10 value 1259.639389
#> final  value 1252.051381 
#> converged
#> # weights:  16 (9 variable)
#> initial  value 1384.908067 
#> iter  10 value 1239.414613
#> final  value 1225.548130 
#> converged
summary(f1)
#> Fit to synthetic data set with 3 syntheses. Inference to coefficients
#> and standard errors that would be obtained from the original data.
#> 
#> Call:
#> multinom.synds(formula = edu ~ sex + age, data = s1)
#> 
#> Combined estimates:
#>                                      xpct(Beta) xpct(se.Beta)  xpct(z)
#> VOCATIONAL/GRAMMAR:(Intercept)        4.6439078     0.4056917  11.4469
#> VOCATIONAL/GRAMMAR:sexFEMALE         -0.6611948     0.2093872  -3.1578
#> VOCATIONAL/GRAMMAR:age               -0.0660260     0.0065968 -10.0088
#> SECONDARY:(Intercept)                 4.2371451     0.4107321  10.3161
#> SECONDARY:sexFEMALE                  -0.0099098     0.2169217  -0.0457
#> SECONDARY:age                        -0.0686277     0.0067328 -10.1930
#> POST-SECONDARY OR HIGHER:(Intercept)  3.3800509     0.4325711   7.8139
#> POST-SECONDARY OR HIGHER:sexFEMALE    0.1784190     0.2375075   0.7512
#> POST-SECONDARY OR HIGHER:age         -0.0630109     0.0071533  -8.8087
#>                                      Pr(>|xpct(z)|)    
#> VOCATIONAL/GRAMMAR:(Intercept)            < 2.2e-16 ***
#> VOCATIONAL/GRAMMAR:sexFEMALE                0.00159 ** 
#> VOCATIONAL/GRAMMAR:age                    < 2.2e-16 ***
#> SECONDARY:(Intercept)                     < 2.2e-16 ***
#> SECONDARY:sexFEMALE                         0.96356    
#> SECONDARY:age                             < 2.2e-16 ***
#> POST-SECONDARY OR HIGHER:(Intercept)      5.546e-15 ***
#> POST-SECONDARY OR HIGHER:sexFEMALE          0.45252    
#> POST-SECONDARY OR HIGHER:age              < 2.2e-16 ***
#> ---
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
print(f1, msel = 1:2)
#> Note: To get more details of the fit see vignette on inference.
#> 
#> Call:
#> multinom.synds(formula = edu ~ sex + age, data = s1)
#> 
#> Coefficient estimates for selected synthetic data set(s):
#>       VOCATIONAL/GRAMMAR:(Intercept) VOCATIONAL/GRAMMAR:sexFEMALE
#> syn=1                       4.791488                   -0.8438182
#> syn=2                       4.145338                   -0.4456171
#>       VOCATIONAL/GRAMMAR:age SECONDARY:(Intercept) SECONDARY:sexFEMALE
#> syn=1            -0.06400828              4.175679         -0.09266599
#> syn=2            -0.06301535              3.856689          0.15200686
#>       SECONDARY:age POST-SECONDARY OR HIGHER:(Intercept)
#> syn=1   -0.06590437                             3.635597
#> syn=2   -0.06674652                             3.051785
#>       POST-SECONDARY OR HIGHER:sexFEMALE POST-SECONDARY OR HIGHER:age
#> syn=1                         0.00372223                  -0.06440425
#> syn=2                         0.34436591                  -0.06232803
compare(f1, ods)
#> Error in eval(expr, p): object 'ods' not found