Skip to contents

Predict missing values from the fitted DPMM.

Usage

predict_dpmm_fit(
  object,
  newdata,
  samples = seq(1000, 2500, 100),
  seed = NULL,
  ...
)

Arguments

object

object class 'dpmm_fit'

newdata

dataframe with missingness

samples

vector of iterations to be used in the posterior

seed

specify seed to be used for reproducibility. (default = NULL)

...

other parameters used in 'posterior.dpmm'

Value

A list with n entries for n rows with missingness, each entry is a dataframe with the sampled missing values, in the same row order as 'newdata'. Continuous values are automatically converted back to their original scale, regardless of whether the model was fitted with 'standardise = TRUE'.

Examples

if (FALSE) { # \dontrun{
## load dataset
data(dataset_1)

## fit model
posteriors <- runModel(dataset_1, 
                       mcmc_iterations = 100,
                       L = 6, 
                       mcmc_chains = 2, 
                       standardise = TRUE)
                       
## introduce missing data
rows <- 501:550
dataset_missing <- dataset_1
dataset_missing_predict <- dataset_missing[rows,]
dataset_missing_predict[,1] <- as.numeric(NA)

# predict missing values
posteriors.dpmmfit <- predict_dpmm_fit(posteriors,
                                       dataset_missing_predict,
                                       samples = c(1:100),
                                       seed = 1)
} # }