审稿人:请画出多重填补后的图,谢谢!
install.packages("ggmice")
library(mice)
library(ggplot2)
library(ggmice)
mydata <- boys
summary(mydata)

imputed <- mice(mydata, m = 5, method = "pmm")

ggmice(mydata, aes(x = age, y = hgt)) +
geom_point()

ggmice(mydata, aes(x = reg, y = hgt)) +
geom_point()

ggmice(mydata, aes(x = wgt, y = hgt)) +
geom_point() +
facet_wrap(~ reg == "east", labeller = label_both)

ggmice(imputed, aes(x = age, y = hgt)) +
geom_point()

ggmice(imputed, aes(x = reg, y = hgt)) +
geom_point()

ggmice(imputed, aes(x = wgt, y = hgt)) +
geom_point() +
facet_wrap(~ reg == "east", labeller = label_both)

ggmice(imputed, aes(x = .imp, y = hgt)) +
geom_jitter(height = 0, width = 0.3) +
labs(x = "Imputation number")

ggmice(imputed, aes(x = .imp, y = hgt)) +
geom_jitter(height = 0, width = 0.3) +
geom_boxplot(width = 0.6, size = 1.1, alpha = 0.6, outlier.shape = NA) +
labs(x = "Imputation number")


https://cran.r-project.org/package=ggmice
2024-06-16 12:09