Learn R Programming

RDS (version 0.9-9)

plot.rds.data.frame: Diagnostic plots for the RDS recruitment process

Description

Diagnostic plots for the RDS recruitment process

Usage

# S3 method for rds.data.frame
plot(
  x,
  plot.type = c("Recruitment tree", "Network size by wave", "Recruits by wave",
    "Recruits per seed", "Recruits per subject"),
  stratify.by = NULL,
  ...
)

Value

Either nothing (for the recruitment tree plot), or a ggplot2 object.

Arguments

x

An rds.data.frame object.

plot.type

the type of diagnostic.

stratify.by

A factor used to color or stratify the plot elements.

...

Additional arguments for the underlying plot function if applicable.

Details

Several types of diagnostics are supported by the plot.type argument. 'Recruitment tree' displays a network plot of the RDS recruitment process. 'Network size by wave' monitors systematic changes is network size based on how far subjects are from the seed 'Recruits by wave' displays counts of subjects based on how far they rare from their seed. 'Recruit per seed' shows the total tree size for each seed. 'Recruits per subject' shows counts of how many subjects are recruited by each subject who are non-terminal.

Examples

Run this code
data(fauxmadrona)
if (FALSE) {
plot(fauxmadrona)
}
plot(fauxmadrona, plot.type='Recruits by wave')
plot(fauxmadrona, plot.type='Recruits per seed')
plot(fauxmadrona, plot.type='Recruits per subject')

plot(fauxmadrona, plot.type='Recruits by wave', stratify.by='disease')
plot(fauxmadrona, plot.type='Recruits per seed', stratify.by='disease')
plot(fauxmadrona, plot.type='Recruits per subject', stratify.by='disease')

Run the code above in your browser using DataLab