combine_coef_se: Combines estimated coefficients and associated statistics...

Description Usage Arguments Value Author(s) Source Examples

View source: R/utils.R

Description

Combines estimated coefficients and associated statistics from models estimated with multiply imputed data sets or bootstrapped

Usage

1
combine_coef_se(obj, out_type = "matrix", bagging = FALSE, messages = TRUE)

Arguments

obj

a zelig object with an estimated model

out_type

either "matrix" or "list" specifying whether the results should be returned as a matrix or a list.

bagging

logical whether or not to bag the bootstrapped coefficients

messages

logical whether or not to return messages for what is being returned

Value

If the model uses multiply imputed or bootstrapped data then a matrix (default) or list of combined coefficients (coef), standard errors (se), z values (zvalue), p-values (p) is returned. Rubin's Rules are used to combine output from multiply imputed data. An error is returned if no imputations were included or there wasn't bootstrapping. Please use get_coef, get_se, and get_pvalue methods instead in cases where there are no imputations or bootstrap.

Author(s)

Christopher Gandrud and James Honaker

Source

Partially based on mi.meld from Amelia.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
set.seed(123)

## Multiple imputation example
# Create fake imputed data
n <- 100
x1 <- runif(n)
x2 <- runif(n)
y <- rnorm(n)
data.1 <- data.frame(y = y, x = x1)
data.2 <- data.frame(y = y, x = x2)

# Estimate model
mi.out <- to_zelig_mi(data.1, data.2)
z.out.mi <- zelig(y ~ x, model = "ls", data = mi.out)

# Combine and extract coefficients and standard errors
combine_coef_se(z.out.mi)

## Bootstrap example
z.out.boot <- zelig(y ~ x, model = "ls", data = data.1, bootstrap = 20)
combine_coef_se(z.out.boot)

Zelig documentation built on Jan. 8, 2021, 2:26 a.m.