Fitting ordered logistic models to synthetic data
polr.synds.Rd
Fits ordered logistic models to the synthesised data set(s)
using the polr
function.
Arguments
- formula
a symbolic description of the model to be estimated. A typical model has the form
response ~ predictors
. See the documentation ofpolr
andformula
for details.- data
an object of class
synds
, which stands for 'synthesised data set'. It is typically created by functionsyn
and it includesdata$m
synthesised data set(s).- ...
additional parameters passed to
polr
.
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
polr.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 bysummary.polr
to make it compatible with other fitting methods for thecompare.fit.synds
andsummary.fit.synds
functions. In particular the coefficients combine the items coefficients and zeta fromsummary.polr
to make a combined vector of coefficients.- 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 <- polr.synds(edu ~ sex + age, data = s1)
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:
#> polr.synds(formula = edu ~ sex + age, data = s1)
#>
#> Combined estimates:
#> xpct(Beta) xpct(se.Beta) xpct(z)
#> sexFEMALE 0.2911338 0.1164032 2.5011
#> age -0.0282144 0.0033848 -8.3356
#> PRIMARY/NO EDUCATION|VOCATIONAL/GRAMMAR -2.7767502 0.1932767 -14.3667
#> VOCATIONAL/GRAMMAR|SECONDARY -1.0131272 0.1708651 -5.9294
#> SECONDARY|POST-SECONDARY OR HIGHER 0.5370955 0.1748939 3.0710
#> Pr(>|xpct(z)|)
#> sexFEMALE 0.012382 *
#> age < 2.2e-16 ***
#> PRIMARY/NO EDUCATION|VOCATIONAL/GRAMMAR < 2.2e-16 ***
#> VOCATIONAL/GRAMMAR|SECONDARY 3.04e-09 ***
#> SECONDARY|POST-SECONDARY OR HIGHER 0.002134 **
#> ---
#> 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:
#> polr.synds(formula = edu ~ sex + age, data = s1)
#>
#> Coefficient estimates for selected synthetic data set(s):
#> sexFEMALE age PRIMARY/NO EDUCATION|VOCATIONAL/GRAMMAR
#> syn=1 0.1686917 -0.02452770 -2.676147
#> syn=2 0.2660316 -0.02906759 -2.825912
#> VOCATIONAL/GRAMMAR|SECONDARY SECONDARY|POST-SECONDARY OR HIGHER
#> syn=1 -0.9756189 0.4913396
#> syn=2 -1.0603897 0.4728758
compare(f1, ods)
#> Error in eval(expr, p): object 'ods' not found