hist.datacggm {cglasso}R Documentation

Histogram for a datacggm Object

Description

Creates histograms with a normal density as background and two segments corresponding to left and/or right censored values (if any) in a conditional censored Gaussian graphical model.

Usage

## S3 method for class 'datacggm'
hist(x, breaks = "Sturges", include.lowest = TRUE, right = TRUE, nclass = NULL,
     which, max.hist = 1L, save.hist = FALSE, grdev = pdf, grdev.arg, 
     polygon.col = adjustcolor("grey", alpha.f = 0.25), polygon.border = NA, 
     segments.lwd = 4L, segments.lty = 2L, segments.col = "gray40", 
     points.pch = c(4L, 1L), points.cex = 1.8, points.col = rep("black", 2L), 
     legend = TRUE, ...)

Arguments

x

an object of class ‘datacggm’.

breaks

one of:

  • a vector giving the breakpoints between histogram cells,

  • a function to compute the vector of breakpoints,

  • a single number giving the number of cells for the histogram,

  • a character string naming an algorithm to compute the number of cells,

  • a function to compute the number of cells.

See hist for more details.

include.lowest

logical; if TRUE, an x[i] equal to the breaks value will be included in the first (or last, for right = FALSE) bar. This will be ignored (with a warning) unless breaks is a vector.

right

logical; if TRUE, the histogram cells are right-closed (left open) intervals.

nclass

numeric (integer). For S(-PLUS) compatibility only, nclass is equivalent to breaks for a scalar or character argument.

which

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

max.hist

the maximum number of histograms drawn in a single figure.

save.hist

a logical variable or a string specifying the path of the directory where plots will be saved. Letting ‘save.hist = 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.hist. 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’.

polygon.col

graphical parameter; the colour for filling the area underlying the Gaussian distribution.

polygon.border

graphical parameter; the colour of the border of the Gaussian distribution.

segments.lwd

graphical parameter; the line width used in plotting the segments associated to the symbols specified by ‘points.pch’.

segments.lty

graphical parameter; the line type used in plotting the segments associated to the symbols specified by ‘points.pch’.

segments.col

graphical parameter; the colour used in plotting the segments associated to the symbols specified by ‘points.pch’.

points.pch

graphical parameter; a pair of integers specifying the symbols used to plot the proportion of censored response variables (default ‘points.pch = 4L’) and the probability to observe a censored value (default ‘points.pch = 1L’), respectively.

points.cex

graphical parameter; a numerical value giving the amount by which the symbols, specified by ‘points.pch’, are magnified relative to the default.

points.col

graphical parameter; the colours used to plot the symbols specified by ‘points.pch’.

legend

logical; if ‘TRUE’ legend is added to the plot.

...

additional graphical parameters passed to ‘plot.histogram’.

Details

For each response variable, the method function ‘hist.datacggm’ plots a histogram using only the observed values. Densities, plotted on the y-axis, are computed in such a way that the sum of all densities plus the proportion of censored values is equal to one.

To evaluate the distributional assumption underlying the censored Gaussian distribution, on each histogram the area underlying the Gaussian density function is also shown in the background (marginal parameters are estimated as described in ‘datacggm’ and ‘ColMeans’). Furthermore, on each plot, the proportions of left/right censored values are graphically compared with the corresponding Gaussian tail probabilities. If the assumption about the censoring mechanism is satisfied, then the proportion of censored values and the tail probability are approximately equals to each other.

Author(s)

Gianluca Sottile (gianluca.sottile@unipa.it)

See Also

datacggm, rcggm, ColMeans, ColVars and qqcnorm.

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)
hist(Z, max.hist = 4L)

[Package cglasso version 2.0.7 Index]