IPW.quantile {IPWboxplot}R Documentation

Computes the IPW quantiles

Description

The function calculates the inverse probability weighted quantiles of a numeric vector.

Usage

IPW.quantile(y, px=NULL,x=NULL,probs = seq(0, 1, 0.25))

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.

probs

Required. Numeric vector of probabilities with values in (0,1).

Details

The function computes inverse probability weighted (IPW) quantiles of a numeric vector y adapting for missing observations as in Zhang et al.(2012).

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

We adapted the function weighted.fractile from the isotone package to missing values in variable y. See isotone for more details.

Value

The output of the function is a list with components:

ipw.quantile

Numerical vector of length length(probs) containing the estimated quantiles.

px

Numerical vector of drop-out probabilities.

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.

Examples




## A real data example
library(mice)
data(boys)
attach(boys)
# As an illustration, we consider variable testicular volume, tv.
# To compute the inverse probability weighted (IPW) quartiles
# the covariate age is considered as covariate with predictive capability
# to estimate the vector of drop-out probabilities.

res=IPW.quantile(tv,x=age,probs=c(0.25,0.5,0.75))
res$IPW.quantile

# Compute the inverse probability weighted (IPW) quantiles
# corresponding to the fractiles  0.3, 0.8 and 0.9
# using the covariate age  to estimate the propensity.


res1=IPW.quantile(tv,x=age,probs=c(0.3,0.8,0.9))
res1$IPW.quantile


[Package IPWboxplot version 0.1.2 Index]