IPW_boxplot: Boxplot adapted to missing values

IPW.boxplotR Documentation

Boxplot adapted to missing values

Description

The function draws a modified boxplot adapted to missing values. The drop-out probabilities can be given by the practitioner or fitted through a logistic model using auxiliary covariates. The function returns the usual boxplot of the available data as well as a modified plot which takes into account the missing data model and weights the observations using the estimated/given propensity.

Usage

IPW.boxplot(y,px=NULL,x=NULL,graph=c("IPW","both"),
names=c("IPW  Boxplot", "NAIVE  Boxplot"), size.letter=1.2,
lim.inf=NULL,lim.sup=NULL,main=" ",xlab = " ", ylab =" ",color="black")

Arguments

y

Numerical vector of length n with possible missing values codified by NA or NAN.

px

Optional. Numerical vector of drop-out probabilities. If not provided a logistic fit is performed using x as predictive variable. Missing values are not admitted.

x

Optional. The matrix of fully observed variables used to estimate the missing model with dimension nrows=n and ncol=p. Missing values are not admitted. One of the vectors px or x must be supplied.

graph

Optional. Character string indicating if the plot contains two boxplots ("both") or only the boxplot computed with the inverse probability weighted quantiles("IPW"). The default is "IPW".

names

Optional. Character string to name the boxplots. The default is "IPW Boxplot", when graph="IPW" and c("IPW Boxplot", "NAIVE Boxplot") when graph="both".

size.letter

Optional. The font size of names. Default value is 1.2

lim.inf

Optional. The lower limit of the plot if supplied by the user.

lim.sup

Optional. The upper limit of the plot if supplied by the user.

main

Optional. Character string to title the plot. By default no main title is given.

xlab

Optional. Character string to indicate the label of the horizontal axis.

ylab

Optional. Character string to indicate the label of the vertical axis.

color

Optional. Color for the IPW Boxplot.

Details

The function draws boxplots designed to adjust for missing values. The propensity can be supplied by the user or estimated through a logistic model from given covariates.

The function plots as default a modified boxplot based on the inverse probability weighted (IPW) quantiles adapting for missing observations as in Zhang et al.(2012).

By specifying graph = "both", the function displays two parallel boxplots. The boxplot on the left corresponds to the IPW boxplot adapted for missingness, while on the right, the naive boxplot, i.e., the usual boxplot simply computed with the observations y at hand, is displayed.

The user can supply a vector of probabilities px or a set of covariates x to estimate it. When both px and x are supplied, the IPW.boxplot is executed using px. When px is not supplied, it is estimated assuming a logistic model depending on the covariates x . For more details, see Bianco et al. (2018).

Value

The output of the function is a list with components:

px

Numerical vector of probabilities.

IPW.Quartiles

Numerical vector of inverse probability weighted quartiles.

IPW.whisker

Numerical vector of lower and upper whiskers calculated from IPW quartiles.

out.IPW

Numerical vector of data points detected as atypical by the IPW boxplot.

NAIVE.Quartiles

Numerical vector of naive quartiles computed from the subset of non-missing values of y. Returned only when graph="both".

NAIVE.whisker

Numerical vector of lower and upper whiskers obtained from the naive quantiles. Returned only when graph="both".

out.NAIVE

Numerical vector of data points detected as atypical by the naive boxplot. Returned only when graph="both".

Note

The missing values of y must be codified as NA or NAN.

The numerical vector px and the matrix of covariates x must be fully observed. px or x must be supplied by the user.

The lengths of y, px, and nrow(x) must be equal.

Author(s)

Ana Maria Bianco <abianco@dm.uba.ar>, Graciela Boente <gboente@dm.uba.ar> and Ana Perez-Gonzalez <anapg@uvigo.es>.

References

Bianco, A. M., Boente, G., and Perez-Gonzalez, A. (2018). A boxplot adapted to missing values: an R function when predictive covariates are available. Submitted.

Zhang, Z., Chen, Z., Troendle, J. F. and Zhang, J. (2012). Causal inference on quantiles with an obstetric application. Biometrics, 68, 697-706.

See Also

IPW.quantile, IPW.ASYM.Boxplot

Examples



## A real data example

library(mice)
data(boys)
attach(boys)

res1=IPW.boxplot(tv,x=age,main="IPW boxplot of the testicular volume")


# We  can compare the naive and IPW boxplots
res2=IPW.boxplot(tv,x=age,graph="both",main=" ")


IPWboxplot documentation built on Oct. 22, 2023, 1:11 a.m.