splineKM: Display Kaplan-Meier empirical cumulative distribution...

View source: R/splineKM.R

splineKMR Documentation

Display Kaplan-Meier empirical cumulative distribution function and smoothing spline curve fit

Description

This function shows the empirical cumulative distribution function (ECDF) for left-censored data as estimated by the Kaplan-Meier (KM) method and a cubic smoothing spline fitted to it (KMSS method, see multKM).

Usage

splineKM(x, label = NULL, dl = NULL, n.knots = NULL,
            legend.pos = "bottomright",
            ylab = "ECDF", xlab = "Value",
            col.km = "black", lty.km = 1, lwd.km = 1,
            col.sm = "red", lty.sm = 2, lwd.sm = 2, ...)

Arguments

x

Numerical data vector (vector class).

label

Unique label (numeric or character) used to denote left-censored values in x.

dl

Numeric vector of detection limits/thresholds for each element of x (same length as x). These must be given on the same scale as x (use e.g. 0 for detected data).

n.knots

Integer or function giving the number of knots used for fitting a cubic smoothing spline to the KM ECDF (see smooth.spline for default value).

legend.pos

Location of the graph legend. Choose one amongst "bottomleft", "bottomright" (default), "topleft" or "topright".

ylab

Title for y-axis.

xlab

Title for x-axis.

col.km

Plotting color for KM ECDF (see base graphical parameters par).

lty.km

Line type for KM ECDF (see base graphical parameters par).

lwd.km

Line width for KM ECDF (see base graphical parameters par).

col.sm

Plotting color for smoothing spline curve.

lty.sm

Line style for smoothing spline curve.

lwd.sm

Line width for smoothing spline curve.

...

Other graphical parameters.

Value

Graphical output.

Examples

data(Water)
data(mdl)

# Examine default spline smoothed KM ECDF fit for Potassium and Sulphate
splineKM(Water[,1],label=0,mdl[,1])
splineKM(Water[,4],label=0,mdl[,4],xlim=c(28,41))

# Reduce to 5 knots for Potassium
splineKM(Water[,1],label=0,mdl[,1],n.knots=5)

zCompositions documentation built on June 22, 2024, 9:46 a.m.