plot.geimCV | R Documentation |
Plot geimCV results
## S3 method for class 'geimCV'
plot(
x,
join.plots = TRUE,
to_plot = colnames(x$cve[[1]]),
names = as.character(x$formula_list),
names.arrange = NULL,
tcol = 1,
swarm = T,
swarmargs = list(pch = 16),
main = NULL,
...
)
x |
a geimCV object, as returned by |
join.plots |
boolean ; if TRUE, sets up par(mfrow) appropriately |
to_plot |
indices to plot, defaults to all computed indices. |
names |
the labels of the models, defaults to model formulas. |
names.arrange |
if defined, prints names with shifted height (like 'steps') by given number of labels |
tcol |
text color for names (only when |
swarm |
boolean ; if TRUE, displays individual values on top of boxplots as swarms |
swarmargs |
list of parameters given to |
main |
title of the plots, pasted with indices on each plot. |
... |
extra arguments passed on to |
invisibly returns a list of boxplot objects that can be re-plotted through bxp
.
requireNamespace('wormRef', quietly = TRUE)
requireNamespace('stats', quietly = TRUE)
# gene expression data
X <- wormRef::Cel_larval$g
# pheno data (e.g time, batch)
p <- wormRef::Cel_larval$p
# do a pca & select nb of components to use for interpol
pca <- stats::prcomp(X, rank = 20)
nc <- sum(summary(pca)$importance[3, ] < .999) + 1
# find optimal spline type
# setup formulas
smooths <- c('bs', 'tp', 'cr', 'ds')
flist <- as.list(paste0('X ~ s(age, bs = \'', smooths, '\') + cov'))
# do CV
cvres <- ge_imCV(X = scale(X), p = p, formula_list = flist,
cv.n = 20, nc = nc)
# check results
plot(cvres, names.arrange = 4) # lowest pred error with 'ds' spline
# build model & make reference
m <- ge_im(X = X, p = p, formula = 'X ~ s(age, bs = \'ds\') + cov', nc = nc)
ref <- make_ref(m, cov.levels = list('cov'='O.20'), n.inter = 100,
t.unit='h past egg-laying (20C)')
# check model interpolation on pca components
par(mfrow = c(2,2))
plot(m, ref, ncs=1:4) # showing first 4 PCs
# test
ae_X <- ae(X, ref)
par(mfrow = c(1,2))
plot(p$age, ae_X$age.estimates[,1])
plot(ae_X, groups = p$cov)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.