computing standardized effect size when conducting regression analysis with multiply imputed data #331
Replies: 5 comments
-
I believe the following All the best, Gerko library(mice)
#>
#> Attaching package: 'mice'
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following objects are masked from 'package:base':
#>
#> cbind, rbind
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(purrr)
# impute
imp <- mice(boys, m = 3, maxit = 2) # proof of concept
#>
#> iter imp variable
#> 1 1 hgt wgt bmi hc gen phb tv reg
#> 1 2 hgt wgt bmi hc gen phb tv reg
#> 1 3 hgt wgt bmi hc gen phb tv reg
#> 2 1 hgt wgt bmi hc gen phb tv reg
#> 2 2 hgt wgt bmi hc gen phb tv reg
#> 2 3 hgt wgt bmi hc gen phb tv reg
# calculate inference
complete(imp, "all") %>%
map(select, age, hgt, bmi, tv) %>%
map(scale) %>%
map(as.data.frame) %>%
map(lm, formula = age ~ hgt + bmi + tv) %>%
pool()
#> Class: mipo m = 3
#> term m estimate ubar b t dfcom
#> 1 (Intercept) 3 -1.536027e-16 4.894218e-05 2.747795e-31 4.894218e-05 744
#> 2 hgt 3 8.267806e-01 1.278146e-04 1.224933e-04 2.911389e-04 744
#> 3 bmi 3 3.349698e-02 8.417390e-05 2.877139e-08 8.421226e-05 744
#> 4 tv 3 1.659829e-01 1.335759e-04 2.164393e-04 4.221617e-04 744
#> df riv lambda fmi
#> 1 741.931079 7.485825e-27 7.485825e-27 0.002684812
#> 2 6.233579 1.277823e+00 5.609843e-01 0.656075413
#> 3 741.612950 4.557452e-04 4.555376e-04 0.003140273
#> 4 4.203316 2.160462e+00 6.835906e-01 0.771441622 Created on 2020-12-09 by the reprex package (v0.3.0) |
Beta Was this translation helpful? Give feedback.
-
The elegant script by @gerkovink extends the complete-data method by a preliminary rescale of the variables. There are other options possible, but this method is the easiest way to do it. |
Beta Was this translation helpful? Give feedback.
-
Thank you both for the quick and helpful responses. |
Beta Was this translation helpful? Give feedback.
-
Any input on why one might get an error that variables in the first map function were not found? |
Beta Was this translation helpful? Give feedback.
-
Make sure that you use the correct |
Beta Was this translation helpful? Give feedback.
-
Not an issue, but a question about functionality with the mice package (sincere apologies if this the wrong or an inappropriate venue)...
Is there a command/function from the mice package that will return a standardized effect size (i.e., standardized regression coefficient) when conducting regression on multiply imputed data?
Some background:
I am conducting regression analysis with multiply imputed data—specifically, 25 imputed data sets (“m=25”)—and I want to compute the standardized effect size for a regression coefficient of primary interest. In an "ordinary" circumstance, with just one data set, I would divide the coefficient estimate by the outcome variable’s standard deviation. In this case, however, there is no single standard deviation for the outcome variable. This is because the outcome variable is imputed itself. Hence the standard deviation of the outcome varies, albeit marginally, across the imputed data sets.
Is there a command from mice that can be used to compute this standardized effect size (standardized regression coefficient? I suppose an alternative solution would be to first standardized the variables entering the the regression model, but I am wondering if there might be a command that would avoid that preliminary step (say, a command that pools the standard deviations of the outcome variable across the imputed data sets).
Note, I know that the standard error of the estimate (or variance estimate for the coefficient) is a pooled estimate (using Rubin’s rules). However, I am referring here to the standard deviation (sample statistic) of the outcome variable—the value that serves as the denominator over which the coefficient estimate would be divided for calculating the standardized effect size.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions