Last chance! 50% off unlimited learning
Sale ends in
Interface for deductiveZeros for objects of class editmatrix. This interface
is robust for variables in x
not occuring in E
.
Suppose $x$ is a record under linear constraints $Ax=b$ and $x\geq0$. In certain cases some missing values can be imputed uniquely with zeros. For example, in the case that $x_1+x_2=x_3$, if $x_2$ is missing and $x_1=x_3\geq 0$, then $x_2$ is uniquely determined to be 0. This function returns a boolean vector indicating which of the missing values are uniquely determined to be zero.
deductiveZeros(E, x, ...)
"deductiveZeros"(E, x, ...)
"deductiveZeros"(E, x, b, adapt = logical(length(x)), nonneg = rep(TRUE, length(x)), roundNearZeros = TRUE, tol = sqrt(.Machine$double.eps), ...)
editmatrix
or Equality constraint matrix.E
is an equality constraint matrix.deductiveZeros,matrix
x
A
before determining the sign?adapt
vector.By default it is assumed that all values must obey the nonnegativity constraint. However this
can be determined by specifying nonneg
.
deduImpute
, solSpace
# a simple example"
E <- editmatrix(c(
"x1 + x2 + x3 == xt",
"x1 >= 0", "x2>=0","x3>=0", "xt>=0"))
x <- c(x1=10,x2=NA,x3=5,xt=15)
# with deductiveZeros we get:
( I <- deductiveZeros(E,x) )
x[I] <- 0
any(violatedEdits(E,x))
# This example is taken from De Waal et al (2011) (Examples 9.1-9.2)
E <- editmatrix(c(
"x1 + x2 == x3",
"x2 == x4",
"x5 + x6 + x7 == x8",
"x3 + x8 == x9",
"x9 - x10 == x11",
"x6 >= 0",
"x7 >= 0"
))
x <- c(
x1 = 145,
x2 = NA,
x3 = 155,
x4 = NA,
x5 = 86,
x6 = NA,
x7 = NA,
x8 = 86,
x9 = NA,
x10 = 217,
x11 = NA)
# determine zeros:
I <- deductiveZeros(E,x)
# impute:
x[I] <- 0
Run the code above in your browser using DataLab