qqcnorm {cglasso}R Documentation

Quantile-Quantile Plots for a datacggm Object

Description

Creates a quantile-quantile plot for a censored Gaussian distribution.

Usage

qqcnorm(x, which, max.plot = 1L, save.plot = FALSE, grdev = pdf, grdev.arg,
        main = "Censored Normal Q-Q Plot", xlab = "Theoretical Quantiles",
        ylab = "Sample Quantiles", plot.it = TRUE, plot.pch = c(2L, 20L),
        plot.col = c(2L, 1L), plot.cex = c(2L, 1L), abline = FALSE,
        line.col = "gray50", line.lwd = 1L, line.lty = 2L, ...)

Arguments

x

an object of class ‘datacggm’.

which

a vector of integers used to specify the response variables for which the histogram is required.

max.plot

the maximum number of plots drawn in a single figure.

save.plot

a logical variable or a string specifying the path of the directory where plots will be saved. Letting ‘save.plot = TRUE’, the required plots will be saved as external files inside the current working directory. User can save these files on a specific working directory passing the absolute path through the argument save.plot. On exit, working directory will be always set the previous one.

grdev

the graphics device used to save the required histograms on external files. See ‘device’ for more details.

grdev.arg

additional parameters passed to the graphics device specified by ‘grdev’.

main, xlab, ylab

plot labels.

plot.it

logical. Should the result be plotted?

plot.pch

a pair of graphical parameters. The first entry specifies the symbol used for plotting the points associated to the censoring values lo and up (by default a triangle), whereas the second entry specifies the symbol used for the remaining points (by default a black point).

plot.col

a pair of graphical parameters. The first entry specifies the colour used for plotting the points associated to the censoring values lo and up (by default a red triangle), whereas the second entry specifies the colour used for the remaining points (by default a black point).

plot.cex

a pair of graphical parameters. The first entry specifies the size of the symbol used for plotting the points associated to the censoring values lo and up, whereas the second entry specifies the size of the symbol used for the remaining points.

abline

logical. Should the line y = x be plotted?

line.col

graphical parameter. If ‘abline = TRUE’, then this argument specifies the colour of the line y = x.

line.lwd

graphical parameter. If ‘abline = TRUE’, then this argument specifies the line width of the line y = x.

line.lty

graphical parameter. If ‘abline = TRUE’, then this argument specifies the line type of the line y = x.

...

additional graphical parameter passed to ‘plot’.

Details

qqcnorm’ produces a censored normal QQ plot, that is, a graphical method for comparing the empirical distribution of a given response variable (specified by the argument which) to the censored Gaussian distribution, which is defined as:

\Phi((lo - \mu)/\sigma) if y\le lo
\phi((y - \mu)/\sigma) / \sigma if lo < y < up
1 - \Phi((up - \mu)/\sigma) if y\ge up

where \phi and \Phi are the probability density function and the cumulative ditribution of the standard normal distribution, respectively, whereas lo and up are the lower and upper censoring values, respectively.

The comparison is done by plotting the empirical quantiles (y-coordinate) against the theoretical quantiles (x-coordinate) of the censored Gaussian distribution, which are defined as follows:

lo if p \le \Phi((lo - \mu)/\sigma)
\mu + \sigma \Phi^{-1}(p) if \Phi((lo - \mu)/\sigma) < p < 1 - \Phi((up - \mu)/\sigma)
up if p \ge 1 - \Phi((up - \mu)/\sigma)

where p\in(0, 1). If the two distributions are similar, the points will approximately lie on the line y = x. If the distributions are linearly related, the points will approximately lie on a line, but not necessarily on the line y = x. In order to evaluate if the proportions of left/right-censored values are similar to the Gaussian tail probabilities, points corresponding to the censored values are plotted using a specific symbol (see argument ‘plot.pch’), colour (see argument ‘plot.col’) and size (see argument ‘plot.cex’).

Finally, maximum likelihood estimates of the marginal parameters \mu and \sigma are computed as described in ‘datacggm’ and can be extracted from an R of class ‘datacggm’ by using the functions ‘ColMeans’ and ‘ColVars’, respectively.

Value

A named list is silently returned. Each element of the list contains a two-columns matrix; first columns (named ‘x’) contains the theoretical quantiles whereas second columns (named ‘y’) contains the empirical quantiles.

Author(s)

Gianluca Sottile (gianluca.sottile@unipa.it)

References

Augugliaro L., Sottile G., Wit E.C., and Vinciotti V. (2023) <doi:10.18637/jss.v105.i01>. cglasso: An R Package for Conditional Graphical Lasso Inference with Censored and Missing Values. Journal of Statistical Software 105(1), 1–58.

Augugliaro, L., Sottile, G., and Vinciotti, V. (2020) <doi:10.1007/s11222-020-09945-7>. The conditional censored graphical lasso estimator. Statistics and Computing 30, 1273–1289.

Augugliaro, L., Abbruzzo, A., and Vinciotti, V. (2020) <doi:10.1093/biostatistics/kxy043>. \ell_1-Penalized censored Gaussian graphical model. Biostatistics 21, e1–e16.

See Also

datacggm, rcggm, ColMeans, ColVars and hist.datacggm.

Examples

set.seed(123)

# a dataset from a right-censored Gaussian graphical model
n <- 1000L
p <- 10L
Y <- matrix(rnorm(n * p), n, p)
up <- 1
Y[Y >= up] <- up
Z <- datacggm(Y = Y, up = up)
qqcnorm(Z, max.plot = 4L)

# a dataset from a  conditional censored Gaussian graphical model
n <- 1000L
p <- 10L
q <- 2
Y <- matrix(rnorm(n * p), n, p)
up <- 1
lo <- -1
Y[Y >= up] <- up
Y[Y <= lo] <- lo
X <- matrix(rnorm(n * q), n, q)
Z <- datacggm(Y = Y, lo = lo, up = up, X = X)
qqcnorm(Z, max.plot = 4L)

[Package cglasso version 2.0.7 Index]