Skip to contents

Convenience wrapper over pool_synth() for the common case: fit the same glm() on each synthetic dataset and combine. With the default family = gaussian() this is an ordinary linear model.

Usage

synth_glm(
  object,
  formula,
  family = stats::gaussian(),
  rule = c("synthpop", "reiter"),
  population_inference = TRUE,
  conf.level = 0.95,
  ...
)

Arguments

object

A synth_result from synth().

formula

A model formula (e.g. y ~ x1 + x2).

family

A family() for glm(); default gaussian() (linear model).

rule, population_inference, conf.level

Passed to pool_synth().

...

Further arguments to glm().

Value

A flexsynth_pool object (see pool_synth()).

Examples

d <- data.frame(id = 1:400, x = rnorm(400))
d$y <- rbinom(400, 1, plogis(-0.5 + d$x))
res <- synth(d, ~ id, m = 5, seed = 1)
synth_glm(res, y ~ x, family = binomial())
#> <flexsynth_pool> pooled inference from 5 synthetic dataset(s)
#>   rule: synthpop   population inference   (n = 400, k = 400)
#>         term estimate std.error statistic  p.value conf.low conf.high
#>  (Intercept) -0.36017   0.12978    -2.775 5.52e-03 -0.61452  -0.10581
#>            x  1.18342   0.15033     7.872 3.49e-15  0.88877   1.47807