survPMFPlot: Plots marginal and joint probability mass functions.

View source: R/survPMFPlot.R

survPMFPlotR Documentation

Plots marginal and joint probability mass functions.

Description

Plots marginal and joint probability mass functions for bivariate survival data.

Usage

survPMFPlot(bivarSurf, gridWidthX, gridWidthY,
scaleGapX, scaleGapY, scaleHistX, scaleHistY,
XAxisLabel, YAxisLabel, lineXAxisLabel, lineYAxisLabel,
timeLabelScale, axisLabelScale,
labelSkipX, labelSkipY, roundX, roundY,
plotLabel, linePlotLabel)

Arguments

bivarSurf

A matrix containing marginal and joint survival probabilities. The first column is the marginal survival probability corresponding to variable X. The first row is the marginal survival probability corresponding to variable Y. The rest of the matrix contains the joint survival probabilities. The row names of bivarSurf are ordered X values. The column names of bivarSurf are ordered Y values. Element bivarSurf[1,1] equals 1. Its row and column name is '0' (see the documentation for the return value DabrowskaEst in function survDabrowska)

gridWidthX

Grid size on X-axis.

gridWidthY

Grid size on Y-axis.

scaleGapX

The proportion by which the gap between the marginal and joint histograms along the X-axis is increased (if >1) or decreased (if >0 and <1).

scaleGapY

The proportion by which the gap between the marginal and joint histograms along the Y-axis is increased (if >1) or decreased (if >0 and <1).

scaleHistX

The proportion by which to increase (if >1) or decrease (if >0 and <1) the height of the marginal histogram along the X-axis.

scaleHistY

The proportion by which to increase (if >1) or decrease (if >0 and <1) the height of the marginal histogram along the Y-axis.

XAxisLabel

X-axis label.

YAxisLabel

Y-axis label.

lineXAxisLabel

Line where to place the X-axis label (used by function mtext).

lineYAxisLabel

Line where to place the Y-axis label (used by function mtext).

timeLabelScale

The proportion by which the axis labels is increased (if >1) or decreased (if >0 and <1).

axisLabelScale

The proportion by which the time grid labels are increased (if >1) or decreased (if >0 and <1).

labelSkipX

If the time grid looks too busy, not all X-label time grid labels have to be printed. For example, if labelSkipX = 1 then every other label is printed starting from the first (time 0). If labelSkipX = 2 then the 1st, 4rd, 7th, 10th, ... and so on, labels are printed. The default is 0, which means that all time grid labels are printed.

labelSkipY

If the time grid looks too busy, not all Y-label time grid labels have to be printed. For example, if labelSkipY = 1 then every other label is printed starting from the first (time 0). If labelSkipX = 2 then the 1st, 4rd, 7th, 10th, ... and so on, labels are printed. The default is 0, which means that all time grid labels are printed.

roundX

Number of decimal places in time grid labels for X-label.

roundY

Number of decimal places in time grid labels for Y-label.

plotLabel

Plot label.

linePlotLabel

Line where to place the plot label (used by function mtext).

Details

Plots marginal and joint probability mass functions (PMFs) from marginal and joint survival probabilities. The probability mass gets aggregated into cells according to the user-specified arguments gridWidthX and gridWidthY. After this aggregation, the negative values (if any) are set to zero. Marginal probability mass functions are displayed as histograms. Joint probability mass function is displayed as a matrix with darker cells indicating larger probability mass aggregated in this cell. Zero mass is denoted with a very faint gray shade. Because the shading is relative, with greater range of probability mass more gray shades are observed. A future version of the function will allow users to choose their own shading/color function.

Value

None

Author(s)

Svetlana K Eden, svetlanaeden@gmail.com

References

Eden, S.K., Li, C., Shepherd B.E. (2021). Non-parametric Estimation of Spearman's Rank Correlation with Bivariate Survival Data. Biometrics (under revision).

Examples

X = c(0.5, 0.61, 0.6, 0.8, 0.78, 0.7, 0.9)
Y = c(0.44, 0.15, 0.77, 0.88, 0.22, 0.99, .33)
deltaX = c(1, 0, 1, 1, 0, 1, 0)
deltaY = c(1, 0, 1, 0, 1, 1, 1)

dabrSurf = survDabrowska(X, Y, deltaX, deltaY)$DabrowskaEst

grid = 0.1
survPMFPlot(bivarSurf = dabrSurf, gridWidthX = grid, gridWidthY = grid,
            scaleGapX = 1, scaleGapY = 1,
            XAxisLabel = "X", YAxisLabel = "Y", timeLabelScale = 1,
            axisLabelScale = 1,
            labelSkipX = 0, labelSkipY = 0, roundX = 2, roundY = 2,
            plotLabel = "Bivariate PMF")


survSpearman documentation built on Sept. 27, 2022, 1:10 a.m.