is.na.rv
returns the distribution (random variable) of the indicator
function of missing data. rv.all.na
returns TRUE
if all
components of the argument vector are completely missing. rv.any.na
returns TRUE
if any component of the argument vector has missing
values.
# S3 method for rv
is.na(x)
an rv object
is.na.rv
returns a "Bernoulli" random vector of the same
length and dimension as those of x
.
rv.all.na
and rv.any.na
return TRUE
or FALSE
(single value).
Internally, is.na.rv
applies the function is.na
to each
simulation of each component of the argument vector.
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
See also vignette("rv")
.
x <- trunc(rvnorm(1))
y <- !(x==0 & NA) # TRUE if x!=0
x <- y*x
is.na(x) # 69%: Pr(-1<Z<1)
#> mean sd 1% 2.5% 25% 50% 75% 97.5% 99% sims
#> [1] 0.68 0.47 0 0 0 1 1 1 1 200
is.logical(is.na(x)) # TRUE
#> [1] FALSE
rv.any.na(x) # TRUE
#> [1] TRUE
rv.all.na(x) # FALSE
#> [1] FALSE