Replace missing values with random numbers from a normal distribution based
on (a fraction of) the row min and a standard deviation estimated from the
linear relationship between row standard deviation and mean of the full data
sd_fraction allows to further reduce the estimated
Imputed values are taken from a normal distribution with mean being a
user defined fraction of the row minimum and the standard deviation
estimated for that mean based on the linear relationship between row
standard deviations and row means in the full matrix
To largely avoid imputed values being negative or larger than the real
values, the standard deviation for the random number generation is estimated
ignoring the intercept of the linear model estimating the relationship
between standard deviation and mean. If
abs = TRUE
NA values are
replaced with the absolute value of the random values.
imputeLCMD package for more left censored imputation functions.
Other imputation functions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
library(faahKO) data("faahko") xset <- group(faahko) mat <- groupval(xset, value = "into") ## Estimate the relationship between row sd and mean. The standard deviation ## of the random distribution is estimated on this relationship. mns <- rowMeans(mat, na.rm = TRUE) sds <- apply(mat, MARGIN = 1, sd, na.rm = TRUE) plot(mns, sds) abline(lm(sds ~ mns)) mat_imp <- imputeRowMinRand(mat) head(mat) head(mat_imp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.