plotPosteriors: Plot Posteriors for Infered Parameters

Description Usage Arguments Value Examples

Description

Plots the results of the calculations from calculatePosteriors for a single gene. Allows for the selection of custom plotting bounds as well as the recalculation of the posterior distribution within those bounds.

Recalculation of the posterior is useful for obtaining better resolution for plots that are significantly 'zoomed in' compared to the original posterior calculation. This also allows you to avoid having to call calculatePosteriors if you are only interested in looking at one gene at a time.

Note: calculatePosteriors must be run before calling this method unless recalculate = T in which case it does not need to be run.

Usage

1
2
plotPosteriors(object, geneIdx, alphaRange=NULL,
  betaRange=NULL, relative=T, recalculate=F, ...)

Arguments

object

A basicKineticModel object

geneIdx

The gene for which to plot the posterior distribution

...

Additional arguments needed for recalculating the posterior distribution. Only used if recalculate = TRUE. See calculatePosteriors for details on which parameters need to be supplied.

alphaRange

Determines the range of alpha values to plot over. Must be specified as c(lower,upper). See relative for more information on how to specify the range. If not specified, will default to the original range used when calculatePosteriors was called.

betaRange

Determines the range of beta values to plot over. Must be specified as c(lower,upper). See relative for more information on how to specify the range. If not specified, will default to the original range used when calculatePosteriors was called.

relative

Boolean used to determine whether parameter ranges are specified as relative or absolute. If TRUE, the ranges are treated as multiples of the estimated parameter to plot over (eg. alphaRange = c(.25,2) will plot from .25*alpha to 2*alpha). If FALSE then the ranges are treated as absolute values of the specified parameter.

recalculate

Boolean used to determine if the posterior distribution should be recalculated for the selected gene and parameter boundaries.

Value

A ggplot2 plot object containing the posterior plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
##setup
bkm=basicKineticModel(times=0:30,synthRate=1:10,degRate = rep(0.5,10))
bkm=simulateData(bkm)
bkm=simulateReads(bkm,expectedLibSize=10^6,replicates=3,spikeInSizes = 200,dispersionModel=function(x){rep(10^3,length(x))}) #CLUGE
bkm=inferParameters(bkm)
bkm=calculatePosteriors(bkm,alphaRange=c(.25,2))

##plot entire distribution
plotPosteriors(bkm,geneIdx=3)

##plot absolute subset of distribution
plotPosteriors(object=bkm,geneIdx=3,alphaRange=c(3000,4500),betaRange=c(.45,.55),relative=F)

##plot relative subset of distribution
plotPosteriors(object=bkm,geneIdx=3,alphaRange=c(.9,1.1))

##plot subset and recalculate posterior distribution (to obtain higher resolution)
#note: calculatePosteriors does NOT need to be run prior to plotting if recalculate=T
plotPosteriors(object=bkm,geneIdx=3,alphaRange=c(3000,4500),betaRange=c(.45,.55),relative=F,recalculate=T,paramSpaceSize=10^5)

ndukler/tkSim documentation built on May 16, 2019, 8:12 p.m.