bounded: Class "bounded-continuous"

Description Objects from the Classes Slots Author(s) See Also Examples

Description

The bounded-continuous class inherits from the continuous-class and is intended for variables whose observations fall within open intervals that have known boundaries. Although proportions satisfy this definition, the proportion-class should be used in that case. At the moment, a bounded continuous variable is modeled as if it were simply a continuous variable, but its mi-methods impute the missing values from a truncated normal distribution using the rtruncnorm function in the truncnorm package. Note that the default transformation is the identity so if another transformation is used, the bounds must be specified on the transformed data. Aside from these facts, the rest of the documentation here is primarily directed toward developers.

Objects from the Classes

Objects can be created that are of bounded-continuous class via the the missing_variable generic function by specifying type = "bounded-continuous" as well as lower and / or upper

Slots

The bounded-continuous class inherits from the continuous class and is intended for variables that are supported on a known interval. Its default transformation function is the identity transformation and its imputation_method must be "ppd". It has two additional slots:

upper

a numeric vector whose length is either one or the value of the n_total slot giving the upper bound for every observation; NAs are not allowed

lower

a numeric vector whose length is either one or the value of the n_total slot giving the lower bound for every observation; NAs are not allowed

Author(s)

Ben Goodrich and Jonathan Kropko, for this version, based on earlier versions written by Yu-Sung Su, Masanao Yajima, Maria Grazia Pittau, Jennifer Hill, and Andrew Gelman.

See Also

missing_variable, continuous-class, positive-continuous-class, proportion-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# STEP 0: GET DATA
data(CHAIN, package = "mi")

# STEP 0.5 CREATE A missing_variable (you never need to actually do this)
lo_bound <- 0
hi_bound <- rep(Inf, nrow(CHAIN))
hi_bound[CHAIN$log_virus == 0] <- 6
log_virus <- missing_variable(ifelse(CHAIN$log_virus == 0, NA, CHAIN$log_virus), 
                              type = "bounded-continuous", lower = lo_bound, upper = hi_bound)

show(log_virus)

Example output

Loading required package: Matrix
Loading required package: stats4
mi (Version 1.0, packaged: 2015-04-16 14:03:10 UTC; goodrich)
mi  Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Trustees of Columbia University
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under the General Public License version 2 or later.
Execute RShowDoc('COPYING') for details.
Loading required namespace: truncnorm
                type missing method   family     link transformation
y bounded-continuous     367    ppd gaussian identity       identity

mi documentation built on May 1, 2019, 10:13 p.m.