Perform Snapshot Analysis Comparing Two Sets of Signatures from GSLCCA
Description
Performs ttests to test for differences in the mean loadings between two sets of signatures found using GSLCCA. Corrects for multiple comparisons.
Usage
1 
Arguments
x, y 
a matrix of signatures from a GSLCCA analysis, with one column per subject. 
normalise 
logical value indicating whether or not to normalise the signatures first, so that the sum of squares is equal to one. 
p.adjust.method 
the method of adjustment for multiple comparisons, see

... 
further arguments passed to 
Details
In GSLCCA, a signature is the set of loadings or coefficients, \mathbf{a}, of the multivariate response \mathbf{Y}, that give the highest correlation between the y scores \mathbf{Ya} and the fitted nonlinear model.
In the context of EEG analysis the signature represents the relative importance of each frequency in relation to the PK/PD model.
In a GSLCCA analysis with multiple subjects, a signature will have been estimated for each subject. This function compares the mean loading of each variable between two such sets of signatures, using ttests.
When normalise=TRUE
, each signature is first scaled so that the sum of
squared loadings is equal to one.
The pvalues from the ttest are corrected for multiplicity, using the method
given by p.adjust.method
, which specifies the false
discovery rate by default (Benjamini & Hochberg, 1995).
Value
A list with the following components
call 
the call to 
x 
the first set of (normalised) signatures. 
y 
the second set of (normalised) signatures. 
pvalue 
the corrected pvalue. 
Author(s)
Heather Turner
References
Benjamini, Y., and Hochberg, Y. (1995). Controlling the false discovery rate: a practical and powerful approach to multiple testing. Journal of the Royal Statistical Society Series B, 57, 289–300.
See Also
gslcca
, plot.gslcca
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44  data(clonidine)
### Arbitrarily split the rats into two groups of four
###  expect results to be roughly the same!
grp1 < subset(clonidine, Rat < 39)
grp2 < subset(clonidine, Rat >= 39)
## fit same model to each group
result < gslcca(spectra, "Double Exponential",
time = Time, subject = Rat, treatment = Treatment,
subject.smooth = TRUE, pct.explained = 0.96, data = grp1)
result2 < gslcca(spectra, "Double Exponential",
time = Time, subject = Rat, treatment = Treatment,
subject.smooth = TRUE, pct.explained = 0.96, data = grp2)
## run snapshot analysis and plot
##  observed differences far from significant as expected
snap < snapshot(signatures(result), signatures(result2))
par(mfrow = c(2,2))
plot(snap, type = c("signatures", "means", "pvalue"),
names = c("Group 1", "Group 2"))
### Artificially create a difference by swapping the data
### from the delta and theta bands for Group 1
grp1$spectra < grp1$spectra[, c(5:8, 1:4, 9:36)]
colnames(grp1$spectra) < colnames(grp2$spectra)
## refit model for group 1 and rerun snapshot analysis
result < gslcca(spectra, "Double Exponential",
time = Time, subject = Rat, treatment = Treatment,
subject.smooth = TRUE, pct.explained = 0.96, data = grp1)
snap < snapshot(signatures(result), signatures(result2))
## now shows highly significant difference in delta,
## significant difference in theta
## (Group 1 signatures less consistent here)
par(mfrow = c(2,2))
plot(snap, type = c("signatures", "means", "pvalue"),
names = c("Group 1", "Group 2"))
## compact display
par(mfrow = c(1,1))
plot(snap, type = "compact", names = c("Group 1", "Group 2"))
