Description Usage Arguments Value Examples
This function uses Amelia::amelia to impute missing (NA) values in the input data set. This function averages over multiple Amelia imputations to obtain more consistent results. The Amelia imputation model uses all variables of the supplied data_matrix, the first lag of those variables, time, time squared, and day-part dummies.
1 | impute_datamatrix(data_matrix, measurements_per_day, imputation_iterations)
|
data_matrix |
The raw, unimputed data matrix. |
measurements_per_day |
The number of measurements per day. This variable is used for adding day part dummy variables to aid the imputation. |
imputation_iterations |
The amount of times the Amelia imputation should be averaged over. |
This function returns the modified matrix.
1 2 3 4 5 6 7 8 | # create a matrix with some missing values
data_matrix <- matrix(nrow = 40, ncol = 3)
data_matrix[, ] <- runif(ncol(data_matrix) * nrow(data_matrix), 1, nrow(data_matrix))
while (sum(is.na(data_matrix)) == 0)
data_matrix[as.logical(round(runif(ncol(data_matrix) * nrow(data_matrix), -0.3, 0.7)))] <- NA
colnames(data_matrix) <- c('rumination', 'happiness', 'activity')
data_matrix
autovarCore:::impute_datamatrix(data_matrix, 1, 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.