1

I am imputing average follow-up for a meta-analysis using MICE. In studies reporting a maximum follow-up duration, I attempted to constrain imputations so average follow-up is always less than the maximum follow-up.

I used the custom imputation function described in the excellent community top-post here Multiple imputation for missing values

I used the following adjusted code to do so:

function (y, ry, x, donors = 5, type = 1, ridge = 1e-05, version = "", 
          ...) 
{
    max <- max(data[,"maxfollowup"], na.rm=TRUE)
                  )
    repeat{
        vals <- mice.impute.pmm(y, ry, x, donors = 5, type = 1, ridge = 1e-05,
                                version = "", ...)
        if (all(vals < max)){
            break
        }
    }
    return(vals)
}

In reviewing the imputed data, however, some imputed values are greater than the upper limit of the follow-up range. See last row in picture where average > max follow-up. Presumably I did not adjust the code correctly. Where did I go wrong?

See last row

rdmirza
  • 21
  • 3
  • What is "uprange"? If it's the maximum duration of follow-up, then why is it changing with each imputation? – David Luke Thiessen Jan 06 '22 at 16:19
  • Yes "uprange" is the maximum follow-up duration. Where do you see that it is changing with each imputation? I actually solved the problem, will post below. – rdmirza Jan 08 '22 at 23:59

1 Answers1

0

Applying constraints insofar as my question was concerned is documented well in this MICE vingette (1)

Here's the embarrassingly simple code:

long <- complete(imp, "long", include = TRUE)  
long$avg <- with(long, ifelse(avg < uprange, avg, uprange))  
imp <- as.mids(long) 

1: https://www.gerkovink.com/miceVignettes/Passive_Post_processing/Passive_imputation_post_processing.html

rdmirza
  • 21
  • 3