Comments (3)
Just read through the R-script for the chapter on multiple-imputation.com and noticed that you actually write it isn't yet implemented.
from mice.
Yes, this is still one on the todo list
from mice.
Note: I found this code on my machine. I didn't test, and it probably does not work, but can be used for inspiration.
##' Conditional imputation helper
##'
##' Sorry, the \code{ifdo()} function is not yet implemented.
##' @aliases ifdo
##' @param condition a vector of conditions
##' @param action a vector of actions to do when condition is TRUE
##' @return Currently returns an error message.
##' @author Stef van Buuren, 2017
##' @examples
##' \dontrun {
##' # old form
##' ini <- mice(airquality[, 1:2], maxit = 0)
##' post <- ini$post
##' post["Ozone"] <- "imp[[j]][, i] <- squeeze(imp[[j]][, i],c(1, 200))"
##'
##' # ifdo form
##' post["Ozone"] <- "ifdo(c(Ozone < 1, Ozone > 200), c(1, 200))"
##' imp <- mice(airquality[, 1:2], method = "norm.nob", m = 1, maxit = 1, seed = 1, post = post)
##' }
##' @keywords internal
# ifdo <- function(condition, action, data = p$data) {
# if (length(condition) != length(action))
# stop("Different length of `condition` and `action`")
# imputes <- data[where[, j], , drop = FALSE]
# for (k in 1:length(condition)) {
# eval(parse(paste("idx <- with(imputes,", condition[k], ")")))
# if (substring(action[k], 1, 1) == "~") {
# eval(parse(paste("imp[[j]][idx, i] <- model.frame(as.formula(", action[k], "), data = imputes[idx, , drop = FALSE])")))
# } else {
# eval(parse(paste("imp[[j]][idx, i] <- with(imputes[idx, , drop = FALSE], ", action[k])))
# }
# # cat("Function ifdo() not yet implemented.\n")
# }
# }
from mice.
Related Issues (20)
- 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()`
- ampute.discrete failing when input data set contains character/categorical variables HOT 1
- pooling parameters df_error = "Inf" HOT 1
- pool() on lavaan objects gives error: illegal arguments passed to lavaan::parameterEstimates HOT 1
- pool() on lavaan fit objects gives error: coef() not available on S4 object HOT 2
- Add cluster variable to `ampute()` for multilevel amputation
- Change reference level in logistic regression following MI using MICE HOT 2
- Chi square tests following multiple imputation
- mice::ampute() not working properly when adding character variables HOT 1
- futuremice error with blocks - possibly due to how ibind deals with blocked imputations
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.