Skip to content

logged events suggest only one value of a variable may have linear dependence, how to solve this? #610

Closed Answered by stefvanbuuren
ABQTrap asked this question in Q&A
Discussion options

You must be logged in to vote

You didn't say how you run your model, but did I suspect your variable subject_ID has class character or factor. In that case mice expands it into dummy variables. My advice is to keep subject_ID out of the imputation model. See below for a reprex and solution.

library(mice, warn.conflicts = FALSE)

# show problem
df <- mice::nhanes
df$subjid <- rownames(df)
imp1 <- mice(df, print = FALSE, seed = 1)
#> Warning: Number of logged events: 99
head(imp1$loggedEvents)
#>   it im dep     meth
#> 1  0  0     constant
#> 2  1  1 bmi      pmm
#> 3  1  1 bmi      pmm
#> 4  1  1 hyp      pmm
#> 5  1  1 hyp      pmm
#> 6  1  1 chl      pmm
#>                                                            …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ABQTrap
Comment options

@ABQTrap
Comment options

@stefvanbuuren
Comment options

Answer selected by ABQTrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants