Description Usage Arguments Details Value Examples

Evaluate the optimal number of knots required for fitGAM.

Evaluate an appropriate number of knots.

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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | ```
evaluateK(counts, ...)
## S4 method for signature 'matrix'
evaluateK(
counts,
k = 3:10,
nGenes = 500,
sds = NULL,
pseudotime = NULL,
cellWeights = NULL,
U = NULL,
conditions = NULL,
plot = TRUE,
weights = NULL,
offset = NULL,
aicDiff = 2,
verbose = TRUE,
parallel = FALSE,
BPPARAM = BiocParallel::bpparam(),
control = mgcv::gam.control(),
family = "nb",
gcv = FALSE,
...
)
## S4 method for signature 'dgCMatrix'
evaluateK(
counts,
k = 3:10,
nGenes = 500,
sds = NULL,
pseudotime = NULL,
cellWeights = NULL,
plot = TRUE,
U = NULL,
weights = NULL,
offset = NULL,
aicDiff = 2,
verbose = TRUE,
conditions = NULL,
control = mgcv::gam.control(),
parallel = FALSE,
BPPARAM = BiocParallel::bpparam(),
family = "nb",
gcv = FALSE,
...
)
## S4 method for signature 'SingleCellExperiment'
evaluateK(
counts,
k = 3:10,
nGenes = 500,
sds = NULL,
pseudotime = NULL,
cellWeights = NULL,
plot = TRUE,
U = NULL,
weights = NULL,
offset = NULL,
aicDiff = 2,
verbose = TRUE,
conditions = NULL,
parallel = FALSE,
BPPARAM = BiocParallel::bpparam(),
control = mgcv::gam.control(),
family = "nb",
gcv = FALSE,
...
)
## S4 method for signature 'CellDataSet'
evaluateK(
counts,
k = 3:10,
nGenes = 500,
sds = NULL,
pseudotime = NULL,
cellWeights = NULL,
plot = TRUE,
U = NULL,
weights = NULL,
offset = NULL,
aicDiff = 2,
verbose = TRUE,
conditions = NULL,
parallel = FALSE,
BPPARAM = BiocParallel::bpparam(),
control = mgcv::gam.control(),
family = "nb",
gcv = FALSE,
...
)
``` |

`counts` |
The count matrix, genes in rows and cells in columns. |

`...` |
parameters including: |

`k` |
The range of knots to evaluate. '3:10' by default. See details. |

`nGenes` |
The number of genes to use in the evaluation. Genes will be randomly selected. 500 by default. |

`sds` |
Slingshot object containing the lineages. |

`pseudotime` |
a matrix of pseudotime values, each row represents a cell and each column represents a lineage. |

`cellWeights` |
a matrix of cell weights defining the probability that a cell belongs to a particular lineage. Each row represents a cell and each column represents a lineage. |

`U` |
The design matrix of fixed effects. The design matrix should not contain an intercept to ensure identifiability. |

`conditions` |
This argument is in beta phase and should be used carefully. If each lineage consists of multiple conditions, this argument can be used to specify the conditions. tradeSeq will then fit a condition-specific smoother for every lineage. |

`plot` |
Whether to display diagnostic plots. Default to |

`weights` |
Optional: a matrix of weights with identical dimensions
as the |

`offset` |
Optional: the offset, on log-scale. If NULL, TMM is used to
account for differences in sequencing depth, see |

`aicDiff` |
Used for selecting genes with significantly varying AIC values over the range of evaluated knots to make the barplot output. Default is set to 2, meaning that only genes whose AIC range is larger than 2 will be used to check for the optimal number of knots through the barplot visualization that is part of the output of this function. |

`verbose` |
logical, should progress be verbose? |

`parallel` |
Logical, defaults to FALSE. Set to TRUE if you want to parallellize the fitting. |

`BPPARAM` |
object of class |

`control` |
Control object for GAM fitting, see |

`family` |
The distribution assumed, currently only |

`gcv` |
(In development). Logical, should a GCV score also be returned? |

The number of parameter to evaluate (and therefore the runtime) scales in
`k`

* the number of lineages. Morevoer, we have found that, in practice,
values of k above 12-15 rarely lead to improved result, not matter the
complexity of the trajectory being considered. As such, we recommand that user
proceed with care when setting k to value higher than 15.

A plot of average AIC value over the range of selected knots, and a matrix of AIC and GCV values for the selected genes (rows) and the range of knots (columns).

1 2 3 4 5 6 7 | ```
## This is an artifical example, please check the vignette for a realistic one.
set.seed(8)
data(sds, package="tradeSeq")
loadings <- matrix(runif(2000*2, -2, 2), nrow = 2, ncol = 2000)
counts <- round(abs(t(slingshot::reducedDim(sds) %*% loadings))) + 100
aicK <- evaluateK(counts = counts, sds = sds, nGenes = 100,
k = 3:5, verbose = FALSE)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.