Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bounded

Class "bounded-continuous"


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

Examples

# 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)

mi

Missing Data Imputation and Model Checking

v1.0
GPL (>= 2)
Authors
Andrew Gelman [ctb], Jennifer Hill [ctb], Yu-Sung Su [aut], Masanao Yajima [ctb], Maria Pittau [ctb], Ben Goodrich [cre, aut], Yajuan Si [ctb], Jon Kropko [aut]
Initial release
2015-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.