Skip to contents

plot.rmc produces a scatterplot of measure1 on the x-axis and measure2 on the y-axis, with a different color used for each subject. Parallel lines are fitted to each subject's data.

Usage

# S3 method for rmc
plot(
  x,
  dataset = NULL,
  overall = F,
  palette = NULL,
  xlab = NULL,
  ylab = NULL,
  overall.col = "gray60",
  overall.lwd = 3,
  overall.lty = 2,
  ...
)

Arguments

x

an object of class "rmc" generated from the rmcorr function.

dataset

Deprecated: This argument is no longer required

overall

logical: if TRUE, plots the regression line between measure1 and measure2, ignoring the participant variable.

palette

the palette to be used. Defaults to the RColorBrewer "Paired" palette

xlab

label for the x axis, defaults to the variable name for measure1.

ylab

label for the y axis, defaults to the variable name for measure2.

overall.col

the color of the overall regression line

overall.lwd

the line thickness of the overall regression line

overall.lty

the line type of the overall regression line

...

additional arguments to plot.

See also

Examples

## Bland Altman 1995 data
my.rmc <- rmcorr(participant = Subject, measure1 = PaCO2, measure2 = pH, 
                 dataset = bland1995)
#> Warning: 'Subject' coerced into a factor
plot(my.rmc)


#using ggplot instead
if (requireNamespace("ggplot2", quietly = TRUE)){
 ggplot2::ggplot(bland1995, ggplot2::aes(x = PaCO2, y = pH, 
                 group = factor(Subject), color = factor(Subject))) +
      ggplot2::geom_point(ggplot2::aes(colour = factor(Subject))) +
      ggplot2::geom_line(ggplot2::aes(y = my.rmc$model$fitted.values), 
                         linetype = 1)
}



## Raz et al. 2005 data
my.rmc <- rmcorr(participant = Participant, measure1 = Age, measure2 = 
                 Volume, dataset = raz2005)
#> Warning: 'Participant' coerced into a factor
library(RColorBrewer)
blueset <- brewer.pal(8, 'Blues')
pal <- colorRampPalette(blueset)
plot(my.rmc, overall = TRUE, palette = pal, overall.col = 'black')



## Gilden et al. 2010 data
my.rmc <- rmcorr(participant = sub, measure1 = rt, measure2 = acc, 
                 dataset = gilden2010)
#> Warning: 'sub' coerced into a factor
plot(my.rmc, overall = FALSE, lty = 2, xlab = "Reaction Time", 
     ylab = "Accuracy")