Combines estimated coefficients and associated statistics from models estimated with multiply imputed data sets or bootstrapped
combine_coef_se(obj, out_type = "matrix", bagging = FALSE, messages = TRUE)
obj | a zelig object with an estimated model |
---|---|
out_type | either |
bagging | logical whether or not to bag the bootstrapped coefficients |
messages | logical whether or not to return messages for what is being returned |
Partially based on mi.meld
from Amelia.
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.
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)#> How to cite this model in Zelig: #> R Core Team. 2007. #> ls: Least Squares Regression for Continuous Dependent Variables #> in Christine Choirat, Christopher Gandrud, James Honaker, Kosuke Imai, Gary King, and Olivia Lau, #> "Zelig: Everyone's Statistical Software," http://zeligproject.org/# Combine and extract coefficients and standard errors combine_coef_se(z.out.mi)#>#> Estimate Std.Error z value Pr(>|z|) #> (Intercept) -0.1224 0.214 -0.5720 0.567 #> x 0.0304 0.376 0.0808 0.936#> How to cite this model in Zelig: #> R Core Team. 2007. #> ls: Least Squares Regression for Continuous Dependent Variables #> in Christine Choirat, Christopher Gandrud, James Honaker, Kosuke Imai, Gary King, and Olivia Lau, #> "Zelig: Everyone's Statistical Software," http://zeligproject.org/combine_coef_se(z.out.boot)#>#> Estimate Std.Error z value Pr(>|z|) #> (Intercept) -0.1572 0.237 -0.664 0.507 #> x 0.0997 0.385 0.259 0.796