plotDens2: Create a bivariate density plot of the MLE

View source: R/plotDens2.r

plotDens2R Documentation

Create a bivariate density plot of the MLE

Description

This function creates a bivariate density plot of the MLE. It plots the maximal intersections that get positive mass under the MLE, filled with colors that represent the estimated density of F under the assumption that the mass is distributed uniformly over the maximal intersections. In other words, if the MLE assigns mass p to a maximal intersection, then the color represents p/(area of maximal intersection).

Usage

plotDens2(mle, col=gray(seq(.9,.3,len=30)), border=NA,  
          key=TRUE, n.key=10, round.key=2, 
          numbers=FALSE, round.numbers=2, cex.numbers=0.6, 
          xlim=NULL, ylim=NULL, zlim=NULL, breaks=NULL, 
          xlab="", ylab="", main="", sub="")

Arguments

mle

List with elements 'p' and 'rects', as outputted by computeMLE.

col

Color vector used to represent the values of the density, and to fill the maximal intersections. The default value is col=gray(seq(.9,.3,len=30)).

border

Color for rectangle borders of the maximal intersections. The default value NA means that the borders are omitted.

key

Logical, indicating if a color key should be drawn. The default value is TRUE.

n.key

Approximate number of tickmarks for the color key. The default value is 10.

round.key

Number of decimals used for the labels of the color key. The default value is 2.

numbers

Logical, indicating if the total amounts of mass mle$p should be printed in the maximal intersections. The default value is FALSE.

round.numbers

Number of decimals used for numbers. The default value is 2.

cex.numbers

Numerical value giving the amount by which text size of numbers should be scaled relative to the default. The default value is 0.6.

xlim, ylim

Ranges for the plotted x and y values, defaulting to the ranges of the x- and y-coordinates of the relevant corners of the maximal intersections.

zlim

The minimum and maximum values of the density for which colors should be plotted, defaulting to the range of the finite values of the density. Each of the given colors will be used to color an equispaced interval of this range. The midpoints of the intervals cover the range, so that values just outside the range will be plotted (see the documentation of image). This parameter is not used if breaks is specified.

breaks

Numeric vector with break points for the colors, satisfying length(breaks)=length(col)+1. This parameter overrides zlim.

xlab, ylab

Labels for the x- and y-axis. The default values are empty.

main

Title of the plot. The default value is empty.

sub

Sub title of the plot. The default value is empty.

Details

In many cases we assign specific values to represent +/- infinity and (see, e.g., actg181). Note that these values determine the size of maximal intersections that extend to +/- infinity, and hence they also determine the value of the density at such maximal intersections. The value of the density at such maximal intersections is therefore meaningless.

Value

No value is returned.

Author(s)

Marloes Maathuis: maathuis@stat.math.ethz.ch

See Also

computeMLE

Examples

# Load example data:
data(ex)

# Compute the MLE:
mle <- computeMLE(ex)

### Bivariate density plots of the MLE:

# (The colors represent the density=p/(area of maximal intersection))
par(mfrow=c(1,1))
plotDens2(mle, xlim=range(ex[,1:2]), ylim=range(ex[,3:4]), 
 main="Plot of the MLE. Colors represent the density.")
plotRects(ex, add=TRUE)

# Alternative: numbers show the amount of mass in each maximal intersection
plotDens2(mle, col="lightgray", xlim=range(ex[,1:2]), 
 ylim=range(ex[,3:4]), numbers=TRUE, key=FALSE, 
 main="Plot of the MLE")
plotRects(ex, add=TRUE)

MLEcens documentation built on Oct. 18, 2022, 5:05 p.m.

Related to plotDens2 in MLEcens...