Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major update that improves support for formulas specification #582

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4cf4953
Major update that improves support for formulas specification
stefvanbuuren Sep 11, 2023
ea84be3
Convert documentation Rd tags to markdown tags for roxygen2
stefvanbuuren Sep 11, 2023
5c6bee2
Add a data argument to nimp() to calculate number of imputations per …
stefvanbuuren Sep 12, 2023
755c23a
Restore classic predictorMatrix behaviour that sets predictorMatrix[j…
stefvanbuuren Sep 13, 2023
c2da03c
Clean up source, identicate that there is still a problem with edit.s…
stefvanbuuren Sep 13, 2023
28821a6
Create a make.nest(), n2b() and b2n() function for working with nest …
stefvanbuuren Sep 13, 2023
731bf25
Insist that predictorMatrix has a zero diagonal
stefvanbuuren Sep 13, 2023
8f92307
- Prevention of NA propagation
stefvanbuuren Sep 18, 2023
772c876
Add exit checks on mids object
stefvanbuuren Sep 18, 2023
465bd5c
Add test for zero predictorMatrix row if method == "", deal with rela…
stefvanbuuren Sep 18, 2023
c8ed335
Update news
stefvanbuuren Sep 18, 2023
05a0209
Update documentation for mice() arguments
stefvanbuuren Sep 18, 2023
6033fc6
Update list of builtin imputation methods
stefvanbuuren Sep 18, 2023
29fee22
Reorder sequence of mice() arguments
stefvanbuuren Sep 18, 2023
fef881b
Reorder nest in data sequence
stefvanbuuren Sep 19, 2023
ba383eb
Use lowercase 'b' and 'f' for automatic naming of blocks and formulas
stefvanbuuren Sep 19, 2023
4175534
Update error message in mpmm
stefvanbuuren Sep 19, 2023
0166992
Sort terms both for pred and formulas
stefvanbuuren Sep 19, 2023
35b6084
Create a mechanism to inform check.method() of the set of variables t…
stefvanbuuren Sep 21, 2023
65f544f
Introduce NA types in initialize.imp()
stefvanbuuren Sep 21, 2023
d9c6fa6
Update nest printing in print.mids()
stefvanbuuren Sep 21, 2023
b9e398e
Add support for blots to multivariate imputation models
stefvanbuuren Sep 21, 2023
0345ec3
Rename `nest` to `parcel`
stefvanbuuren Sep 21, 2023
07a79e9
Use lower case default block names
stefvanbuuren Sep 21, 2023
53916f4
Rename `blots` to `dots`
stefvanbuuren Sep 21, 2023
3c09055
Rename files from blots/nest to dots/parcel
stefvanbuuren Sep 21, 2023
3cebc30
Add deprecation support for make.blots()
stefvanbuuren Sep 21, 2023
7b7a17c
Implement autoremove in check.predictorMatrix() and check.formulas()
stefvanbuuren Sep 21, 2023
8c4bb38
Write one loggedEvent for each removed variable
stefvanbuuren Sep 22, 2023
24688b1
Abort mice when user speficies mixes of `formulas` and `predictorMatr…
stefvanbuuren Sep 22, 2023
e1c475f
Update NEWS.md
stefvanbuuren Sep 22, 2023
da6396b
Reorder mice() arguments into a clusters of operations
stefvanbuuren Oct 2, 2023
db5caf6
Remove superfluous construct.parcel(), make remove.rhs.variables() in…
stefvanbuuren Oct 2, 2023
f5d5c99
Add MICE 4 Syntax Documentation CONCEPT as a vignette
stefvanbuuren Oct 2, 2023
6edcd71
Rebuild site to include article mice4syntax
stefvanbuuren Oct 2, 2023
232a0b6
Add test for character variable (#601)
stefvanbuuren Apr 17, 2024
09e58ea
Merge main and support_blocks into new branch mice4 (still failing so…
stefvanbuuren Apr 17, 2024
15321b4
Merging update
stefvanbuuren Apr 17, 2024
deac372
Update support_blocks with master
stefvanbuuren Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Sort terms both for pred and formulas
  • Loading branch information
stefvanbuuren committed Sep 19, 2023
commit 016699229d67c73b79b396421a93d34bdcd7d809
10 changes: 6 additions & 4 deletions R/sampler.R
Original file line number Diff line number Diff line change
@@ -238,12 +238,14 @@ sampler.univ <- function(data, r, where, pred, formula, method, yname, k,
if (length(ymove) > 0L) {
formula <- update(formula, paste("~ . + ", paste(ymove, collapse = "+")))
}
s <- unlist(strsplit(format(formula), "[~]"))
xp <- sort(unlist(strsplit(s[2], "[+]")))
xp <- sort(gsub(" ", "", xp))
formula <- reformulate(paste(xp, collapse = "+"), j, env = environment(formula))
}

# sort terms in alphabetic order to obtain exact reproducibility
s <- unlist(strsplit(format(formula), "[~]"))
xp <- sort(unlist(strsplit(s[2], "[+]")))
xp <- sort(gsub(" ", "", xp))
formula <- reformulate(paste(xp, collapse = "+"), j, env = environment(formula))

# get the model matrix
x <- obtain.design(data, formula)