Plot Results from GSLCCA Run with Different Smoothing Settings

Share:

Description

Plot the optimised value, ‘signatures’ (loadings of the Y matrix) or (projected) observed and fitted values (Y and X scores) for a varySmooth object.

Usage

1
2
3
4
5
## S3 method for class 'varySmooth'
plot(x, type = "opt", series = x[[1]]$treatment,
  subject = levels(x[[1]]$subject), ask = dev.interactive(),
  main = NULL, xlab = NULL, ylab = NULL, col = NULL, lty = 1, lwd = 1.5, 
  pch = NULL, space = "bottom", corner = NULL, columns = 2, ...)

Arguments

x

an object of class "varySmooth" as returned by varySmooth

type

the type of plot: either "opt", "signature", "fitted", or "scores".

series

if x[[1]]$treatment is NULL and there are multiple time series for each subject, a factor to differentiate these series.

subject

the subjects to include in the plot, specified by levels of x$subject.

ask

logical: if TRUE, the user is asked before each plot, see par(ask=.). Ignored when only one plot is produced.

main

an overall title for the plot.

xlab

a title for the x axis.

ylab

a title for the y axis.

col

a vector specifying a colour palette to use for the lines/points. By default the palette is specified by rainbow_hcl if available, otherwise the standard plotting colours are used.

lty

a vector of line types, see par.

lwd

a vector of line widths, see par.

pch

a vector of plotting characters, see points.

space

when type = "fitted", the space outside the plot region in which to put the legend, see xyplot. Overrides the corner argument.

corner

when type = "fitted", the corner inside the plot region in which to put the legend, see xyplot.

columns

when type = "fitted", how many columns to use to format the legend, see xyplot.

...

further arguments passed to xyplot.

Details

For type = "opt", the value of the optimisation criterion, log(1 - R^2) is plotted against the number of roots used in the GSLCCA, trellised by subject.

For type = "signature", the loadings of the Y matrix from the GSLCCA are displayed for each subject, trellised by the number of roots used in the GSLCCA. The arguments col and lty control the line style and legend text for each subject.

For type = "fitted", the X scores are displayed, trellised by the number of roots used in the GSLCCA. If there are multiple X scores for each time point, then a line is displayed for each times series specified by series (usually the treatment factor used in GSLCCA) and the arguments col, lty and pch control the display for each series. By default, grey or black is used to display values corresponding to the reference treatment (specified by x$ref).

For type = "scores" the X scores are displayed as for type = "fitted" and points are added for the Y scores, again coloured by series.

Author(s)

Heather Turner

See Also

gslcca, varySmooth

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(clonidine)

### Smoothed data - automatically select number of roots
result <- gslcca(spectra, "Critical Exponential",
    time = Time, treatment = Treatment, subject.smooth = TRUE,
    data = clonidine, subset = Rat == "42")

### Vary number of roots 
multiRoots <- varySmooth(result, 2:15)

## plot optimised value
plot(multiRoots, "opt")

## plot fitted values
plot(multiRoots, "fitted")

## plot signature
plot(multiRoots, "signature")