perplexityPlot: Plot the perplexity and rare cell-types versus fitted Ks

View source: R/plot.R

perplexityPlotR Documentation

Plot the perplexity and rare cell-types versus fitted Ks

Description

the same plot returned by fitLDA() but now callable as a separate function.

Usage

perplexityPlot(models, corpus = NULL, perc.rare.thresh = 0.05)

Arguments

models

list returned from fitLDA

corpus

If corpus is NULL, then it will use the original corpus that the model was fitted to. Otherwise, compute deconvolved topics from this new corpus. Needs to be pixels x genes and nonnegative integer counts. Each row needs at least 1 nonzero entry (default: NULL)

perc.rare.thresh

the number of deconvolved cell-types with mean pixel proportion below this fraction used to assess performance of fitted models for each K. Recorded for each K. (default: 0.05)

Value

a plot indicating the perplexity and number of rare cell-types of a list of fitted LDA models

Examples

data(mOB)
pos <- mOB$pos
cd <- mOB$counts
counts <- cleanCounts(cd, min.lib.size = 100)
corpus <- restrictCorpus(counts, removeAbove=1.0, removeBelow = 0.05)
ldas <- fitLDA(t(as.matrix(corpus)), Ks = seq(2,5))
perplexityPlot(models = ldas, corpus = corpus)


JEFworks-Lab/STdeconvolve documentation built on July 17, 2024, 7:11 a.m.