glm.synds, lm.synds | R Documentation |
Fits generalized linear models or simple linear models to the synthesised
data set(s) using glm
and lm
function respectively.
glm.synds(formula, family = "binomial", data, ...) lm.synds(formula, data, ...) ## S3 method for class 'fit.synds' print(x, msel = NULL, ...)
formula |
a symbolic description of the model to be estimated.
A typical model has the form |
family |
a description of the error distribution
and link function to be used in the model. See the documentation of
|
data |
an object of class |
... |
additional parameters passed to |
x |
an object of class |
msel |
index or indices of synthetic data copies for which coefficient
estimates are to be displayed. If |
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 |
mcoefavg |
combined (average) coefficient estimates. |
mvaravg |
combined (average) variance estimates of |
analyses |
|
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 |
mvar |
a matrix of variance estimates from all |
glm
, lm
,
multinom.synds
, polr.synds
,
compare.fit.synds
, summary.fit.synds
### Logit model ods <- SD2011[1:1000, c("sex", "age", "edu", "marital", "ls", "smoke")] s1 <- syn(ods, m = 3) f1 <- glm.synds(smoke ~ sex + age + edu + marital + ls, data = s1, family = "binomial") f1 print(f1, msel = 1:2) ### Linear model ods <- SD2011[1:1000,c("sex", "age", "income", "marital", "depress")] ods$income[ods$income == -8] <- NA s2 <- syn(ods, m = 3) f2 <- lm.synds(depress ~ sex + age + log(income) + marital, data = s2) f2 print(f2,1:3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.