lccPlot: Plot Fitted Curves from an 'lcc' Object.

View source: R/plotmethod_lcc.R

lccPlotR Documentation

Plot Fitted Curves from an lcc Object.

Description

A plot of predictions versus the time covariate is generated. Predicted values are joined by lines while sampled observations are represented by circles. If the argument components=TRUE is considered in the lcc object, single plots of each statistics are returned on differents pages.

Usage

lccPlot(obj, type, control, ...)

Arguments

obj

an object inheriting from class "lcc", representing a fitted lcc model.

type

character string. If type = "lcc", the output is the LCC plot; if type = "lpc", the output is the LPC plot; and if type = "la" the output is the LA plot. Types "lpc" and "la" are available only if components = TRUE.

control

a list of control values or character strings returned by the function plotControl. Defaults to an empty list. The list may contain the following components:

shape:

draw points considering a shape parameter. Possible shape values are the numbers 0 to 25, and 32 to 127; see aes_linetype_size_shape. Default is 1.

colour:

specification for lines color. Default is "black".

size:

specification for lines size. Should be specified with a numerical value (in millimetres); see aes_linetype_size_shape. Default is 0.5.

xlab:

title for the x axis. Default is "Time".

ylab:

title for the y axis. Default is "LCC", "LPC", or "LA"

scale_y_continuous:

numeric vector of length two providing limits of the scale. Default is c(0,1).

all.plot:

viewport functions for the lcc class. If TRUE, the default, returns an object created by the viewport function with multiple plots on a single page. If FALSE returns a single ggplot object by different pages using the marrangeGrob function.

...

arguments to be passed to facet_wrap function

Value

No return value, called for side effects

Author(s)

Thiago de Paula Oliveira, thiago.paula.oliveira@alumni.usp.br

References

Lin, L. A Concordance Correlation Coefficient to Evaluate Reproducibility. Biometrics, 45, n. 1, 255-268, 1989.

Oliveira, T.P.; Hinde, J.; Zocchi S.S. Longitudinal Concordance Correlation Function Based on Variance Components: An Application in Fruit Color Analysis. Journal of Agricultural, Biological, and Environmental Statistics, v. 23, n. 2, 233–254, 2018.

See Also

lcc.

Examples


data(hue)
## Second degree polynomial model with random intercept, slope and
## quadratic term
fm1<-lcc(data = hue, subject = "Fruit", resp = "H_mean",
         method = "Method", time = "Time", qf = 2, qr = 2,
         components=TRUE)
lccPlot(fm1, type="lcc")
lccPlot(fm1, type="lpc")
lccPlot(fm1, type="la")

## Using themes of ggplot2 package
lccPlot(fm1, type = "lpc")+
 ylim(0,1) +
 geom_hline(yintercept = 1, linetype = "dashed") +
 scale_x_continuous(breaks = seq(1,max(hue$Time),2))+
 theme_bw() +
 theme(legend.position = "none", aspect.ratio = 1,
  axis.line.x = element_line(color="black", size = 0.5),
  axis.line.y = element_line(color="black", size = 0.5),
  axis.title.x = element_text(size=14),
  axis.title.y = element_text(size=14),
  axis.text.x = element_text(size = 14, face = "plain"),
  axis.text.y = element_text(size = 14, face = "plain"))

## Using the key (+) to constructing sophisticated graphics
lccPlot(fm1, type="lcc") +
 scale_y_continuous(limits=c(-1, 1)) +
 labs(title="My title",
 y ="Longitudinal Concordance Correlation",
 x = "Time (Days)")

## Runing all.plots = FALSE and saving plots as pdf
## Not run: 
data(simulated_hue_block)
attach(simulated_hue_block)
fm2<-lcc(data = simulated_hue_block, subject = "Fruit",
         resp = "Hue", method = "Method",time = "Time",
         qf = 2, qr = 1, components = TRUE, covar = c("Block"),
         time_lcc = list(n=50, from=min(Time), to=max(Time)))
ggsave("myplots.pdf",
       lccPlot(fm2, type="lcc", scales = "free"))

## End(Not run)


lcc documentation built on Aug. 25, 2022, 5:08 p.m.

Related to lccPlot in lcc...