Comments (8)
The summary.mira()
function has changed in mice 3.0
. The names of the columns now conform to the broom
package. You can request the estimates directly in the linear or log odds scale, as follows
require(mice, warn.conflicts = FALSE)
packageVersion("mice")
set.seed(123)
nhanes$hyp <- as.factor(nhanes$hyp)
# Can run logistic regression on (non-imputed) dataset
model <- glm(hyp ~ bmi, family = binomial(link = 'logit'), nhanes)
model_or <- exp(cbind(OR = coef(model), confint(model)))
# Using the nhanes dataset as an example
imputed_data <- mice::mice(nhanes, m = 25, method = "pmm",
maxit = 10, seed = 12345, print = FALSE)
imputed_model <- with(imputed_data,
glm(hyp ~ bmi, family = binomial(link = 'logit')))
# linear scale
round(summary(pool(imputed_model), conf.int = TRUE), 3)
# log odds scale
round(summary(pool(imputed_model), conf.int = TRUE, exponentiate = TRUE), 3)
from mice.
That's hugely helpful - thank you for the very quick reply!
from mice.
Using mice v3.3.0, when running the above example code I get the following warning when pooling on the log odds scale using round(summary(pool(imputed_model), conf.int = TRUE, exponentiate = TRUE), 3)
:
Warning message:
In process_mipo(z, object, conf.int = conf.int, conf.level = conf.level, :
Exponentiating coefficients, but model did not use a log or logit link function
This is despite computing the imputed_model
object with family = binomial(link = 'logit'))
as in the example code.
Is it safe to ignore this message, as we know the model was computed using a logit link function?
from mice.
I am experiencing a very similar issue as @jaminday - any update on this?
I am calling the function as follows:
imp_long %>%
by(as.factor(.$.imp), glm, formula=k2, family=binomial(link="logit")) %>%
pool() %>%
summary(conf.int=T, exponentiate=T)
Warning message is the same as above.
from mice.
The warning comes from an inappropriate test of the mipo
object, which does not preserve the model settings. The warning can be ignored. It is actually superfluous, and therefore removed in mice 3.4.2
.
from mice.
The
summary.mira()
function has changed inmice 3.0
. The names of the columns now conform to thebroom
package. You can request the estimates directly in the linear or log odds scale, as followsrequire(mice, warn.conflicts = FALSE) packageVersion("mice") set.seed(123) nhanes$hyp <- as.factor(nhanes$hyp) # Can run logistic regression on (non-imputed) dataset model <- glm(hyp ~ bmi, family = binomial(link = 'logit'), nhanes) model_or <- exp(cbind(OR = coef(model), confint(model))) # Using the nhanes dataset as an example imputed_data <- mice::mice(nhanes, m = 25, method = "pmm", maxit = 10, seed = 12345, print = FALSE) imputed_model <- with(imputed_data, glm(hyp ~ bmi, family = binomial(link = 'logit'))) # linear scale round(summary(pool(imputed_model), conf.int = TRUE), 3) # log odds scale round(summary(pool(imputed_model), conf.int = TRUE, exponentiate = TRUE), 3)
Using mice v3.3.0, when running the above example code I get the following warning when pooling on the log odds scale using
round(summary(pool(imputed_model), conf.int = TRUE, exponentiate = TRUE), 3)
:
Using mice v3.15.0, when running the above example code I get the following warning when pooling on the log odds scale using round(summary(pool(imputed_model), conf.int = TRUE, exponentiate = TRUE), 3):
Warning message: Error in Math.data.frame(list(term = 1:35, estimate = c(0.46500606968507, :
non-numeric-alike variable(s) in data frame: term.
I do not know why, This question has been bothering me for a long time, I hope you can reply.
from mice.
The column term
from the summary output is categorical, so the warning indicates that the desired process in rounding makes no sense there.
from mice.
Very thanks! That's hugely helpful ! I have also two questions to ask:
- I have been using MICE to generate imputed datasets, Is it possible to stratify this imputed datasets according to gender and then perform logistic regression. If so how can I stratify this imputed datasets?
- I have been using MICE to generate imputed datasets, Is it possible to run BKMR package analysis (or WQS analysis)using this imputed datasets?
Many thanks for any assistance.
from mice.
Related Issues (20)
- Create a `mice` cheat sheet HOT 1
- Apache Arrow support HOT 2
- Add a progress bar for better time management HOT 5
- `futuremice` scales poorly on 64/128 cores machines HOT 10
- Error message in multilevel imputation HOT 4
- mice.impute.quadratic bug?? HOT 1
- remove.lindep() causes mice.impute.lasso.norm() call to glmnet() to fail in some circumstances HOT 2
- Installing mice fails in Docker rocker/r-ver:4.3.1 HOT 4
- How should mice behave when variables are not specified in the model HOT 1
- Requesting support for GLMMadaptive HOT 1
- Highlight imputed cells in printed data
- Error in pooling ZINB estimates
- Exception needed for multicollinearity error "`No predictors were left`..." for mean imputation? HOT 1
- Error: If no blocks are specified, predictorMatrix must have same number of rows and columns HOT 1
- `ampute()` should preserve the structure of the original data matrix HOT 2
- Reference table of predictor matrix codes
- Error in colMeans(as.matrix(imp[[j]]), na.rm = TRUE) : 'x' must be numeric HOT 4
- Default behavior of `make.predictorMatrix()` outputs `1`s for complete variables HOT 2
- Accidentally repeated roxygen comments HOT 3
- Add `cluster` argument to `make.method()` and `make.predictorMatrix()`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mice.