impute_lr {deductive} | R Documentation |
Impute values derived from linear (in)equality restrictions.
Description
Partially filled records under linear (in)equality
restrictions may reveal unique imputation solutions when the system
of linear inequalities is reduced by substituting observed values.
This function applies a number of fast heuristic methods before
deriving all variable ranges and unique values using Fourier-Motzkin
elimination.
Usage
impute_lr(dat, x, ...)
## S4 method for signature 'data.frame,validator'
impute_lr(dat, x, methods = c("zeros", "piv", "implied"), ...)
Arguments
dat |
an R object carrying data |
x |
an R object carrying validation rules |
... |
arguments to be passed to other methods. |
methods |
What methods to use. Add 'fm' to also compute variable ranges using fourier-motzkin elimination (can be slow and may use a lot of memory). |
Note
The Fourier-Motzkin elimination method can use large amounts of memory and may be slow. When memory allocation fails for a ceratian record, the method is skipped for that record with a message. This means that there may be unique values to be derived but it is too computationally costly on the current hardware.
Examples
v <- validate::validator(y ==2,y + z ==3, x +y <= 0)
dat <- data.frame(x=NA_real_,y=NA_real_,z=NA_real_)
impute_lr(dat,v)