Learn R Programming

MLEcens (version 0.1-2)

plotCDF1: Create a marginal CDF (or survival function) plot of the MLE

Description

This function plots the MLE for a marginal (sub)-CDF (or survival function) for one of the two variables of interest. To be precise, it can plot the MLE for P(X

Usage

plotCDF1(mle, margin, bound="b", int=NULL, surv=FALSE,
         add=FALSE, col=1, lty=1, xlim=NULL, 
         ylim=NULL, xlab="", ylab="", main="", sub="")

Arguments

mle
List with elements 'p' and 'rects', as outputted by computeMLE.
margin
Indicates which margin should be plotted: 1 = x-margin, 2 = y-margin. So if margin=1, the MLE for P(X
bound
Parameter taking the values "u", "l" and "b". It indicates how representational non-uniqueness of the MLE should be handled. Option "u" (upper) indicates an upper bound, obtained by assigning all mass to the lower left corners of the maximal inters
int
This indicates the range of interest of the variable that was not chosen in margin. If int is specified, it should be of the form c(a,b), with a
surv
Logical. The default value is FALSE. If TRUE, the function 1-P(X
add
Logical, indicating if the lines should be added to an existing plot. The default value is FALSE.
col
Line color. The default value is 1="black".
lty
Line type. The default value is 1="solid".
xlim
Range for the horizontal axis, defaulting to the range of x-coordinates (if margin=1) or y-coordinates (if margin=2) of the relevant corners of maximal interesctions.
ylim
Range for the vertical axis, defaulting to the range of values of the estimate.
xlab,ylab
Labels of the x- and y-axis. The default values are empty.
main
Title of the plot.
sub
Sub title of the plot.

Value

  • No value is returned.

concept

  • nonparametric maximum likelihood estimator
  • censored data

See Also

computeMLE

Examples

Run this code
# Load example data:
data(ex)

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

# Plot marginal CDF for X
par(mfrow=c(2,2))
plotCDF1(mle, margin=1, xlim=c(min(ex[,1])-1,max(ex[,2])+1), 
 bound="b", xlab="x", ylab="P(X<=x)", main="MLE for P(X<=x)")

# Plot marginal survival function for X
plotCDF1(mle, margin=1, surv=TRUE, xlim=c(min(ex[,1])-1,max(ex[,2])+1), 
 bound="b", xlab="x", ylab="P(X>x)", main="MLE for P(X>x)")

# Plot marginal CDF for Y
plotCDF1(mle, margin=2, xlim=c(min(ex[,3])-1,max(ex[,4])+1), 
 bound="b", xlab="y", ylab="P(Y<=y)", main="MLE for P(Y<=y)")

# Plot marginal survival function for Y
plotCDF1(mle, margin=2, surv=TRUE, xlim=c(min(ex[,3])-1,max(ex[,4])+1), 
 bound="b", xlab="y", ylab="P(Y>y)", main="MLE for P(Y>y)")

Run the code above in your browser using DataLab