impute: Impute a dataset

imputeR Documentation

Impute a dataset

Description

Impute a dataset

Usage

impute(model, ..., extra, n_imp = 19)

## S4 method for signature 'ANY'
impute(model, ..., extra, n_imp = 19)

## S4 method for signature 'glmerMod'
impute(model, data, ..., extra, n_imp)

## S4 method for signature 'maybeInla'
impute(
  model,
  ...,
  seed = 0L,
  num_threads = NULL,
  parallel_configs = TRUE,
  extra,
  n_imp = 19
)

## S4 method for signature 'lm'
impute(model, data, ..., extra, n_imp)

Arguments

model

model to impute the dataset

...

other arguments. See details

extra

a data.frame with extra observations not used in the model. They will be added in subsequent analyses.

n_imp

the number of imputations. Defaults to 19.

data

The dataset holding both the observed and the missing values

seed

See the same argument in INLA::inla.qsample() for further information. In order to produce reproducible results, you ALSO need to make sure the RNG in R is in the same state, see the example in INLA::inla.posterior.sample(). When seed is non-zero, num_threads is forced to "1:1" and parallel_configs is set to FALSE, since parallel sampling would not produce a reproducible sequence of pseudo-random numbers.

num_threads

The number of threads to use in the format "A:B" defining the number threads in the outer (A) and inner (B) layer for nested parallelism. ⁠A "0"⁠ will be replaced intelligently. seed != 0 requires serial computations.

parallel_configs

Logical. If TRUE and not on Windows, then try to run each configuration in parallel (not Windows) using A threads (see num_threads), where each of them is using B:0 threads.

Examples

dataset <- generate_data(n_year = 10, n_site = 50, n_run = 1)
dataset$Count[sample(nrow(dataset), 50)] <- NA
model <- lm(Count ~ Year + factor(Period) + factor(Site), data = dataset)
impute(model, dataset)

inbo/multimput documentation built on Sept. 17, 2023, 4:35 a.m.