plot_frailty_sd {TimeDepFrail}R Documentation

Plot for the Frailty Standard Deviation or Variance

Description

This function generates a plot of either the frailty standard deviation or the frailty variance for the intervals in the time-domain.

Usage

plot_frailty_sd(
  result,
  frailty_sd = NULL,
  flag_variance = FALSE,
  flag_sd_external = FALSE,
  xlim = c(1, length(result$TimeDomain) - 1),
  ylim = c(0, 10),
  xlab = "Intervals",
  ylab = "Values",
  main_title = "Frailty standard deviation",
  pch = 21,
  color_bg = "blue",
  cex_points = 0.7
)

Arguments

result

An S3 object of class 'AdPaik', returned by the main model call 'AdPaikModel(...)'.

frailty_sd

A numerical vector representing the evaluated frailty standard deviation, with length equal to the number of time-domain intervals. Its elements must be non-negative.

flag_variance

A boolean flag indicating whether to plot the frailty variance (TRUE) or the frailty standard deviation (FALSE). Default is FALSE.

flag_sd_external

A logical flag indicating whether the user is providing an external frailty standard deviation vector.

xlim

A numeric vector of length 2, defining the range for the x-axis (intervals). Default is from 1 to the number of intervals.

ylim

A numeric vector of length 2, defining the range for the y-axis (values). Default is ⁠(0, 10)⁠.

xlab

A string for the x-axis label. Default is 'Intervals'.

ylab

A string for the y-axis label. Default is 'Values'.

main_title

A string for the plot title. Default title is 'Frailty Standard Deviation'.

pch

A numeric or character symbol used for plotting the frailty standard deviation values. Default is a dot (21).

color_bg

A string specifying the color used for the symbols. Default is 'blue'.

cex_points

A numeric value indicating the size of the plotting symbols. Default is 0.7.

Details

The plot represents the values of the frailty standard deviation or variance for each time interval. It connects these points to illustrate the trend of the chosen metric.

This function supports two modes of operation:

The output will differentiate between these two cases, ensuring the correct values are plotted regardless of the source.

Value

A plot displaying either the frailty standard deviation or variance across the specified intervals.

Examples

# Import data
data(data_dropout)

# Define the variables needed for the model execution
eps_paik <- 1e-10
categories_range_min <- c(-8, -2, eps_paik, eps_paik, eps_paik)
categories_range_max <- c(-eps_paik, 0.4, 1 - eps_paik, 1, 10)
time_axis <- c(1.0, 1.4, 1.8, 2.3, 3.1, 3.8, 4.3, 5.0, 5.5, 5.8, 6.0)
formula <- time_to_event ~ Gender + CFUP + cluster(group)

# Call the main model function

result <- AdPaikModel(formula, data_dropout, time_axis, categories_range_min, categories_range_max)

plot_frailty_sd(result, ylim=c(0, 0.50), xlab = 'Time [intervals]', ylab = 'Standard deviation')


[Package TimeDepFrail version 0.0.0.9 Index]