File: thinCounts.Rd

package info (click to toggle)
r-bioc-edger 4.4.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,204 kB
  • sloc: ansic: 3,148; makefile: 5
file content (44 lines) | stat: -rw-r--r-- 1,690 bytes parent folder | download
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
\name{thinCounts}
\alias{thinCounts}

\title{Binomial or Multinomial Thinning of Counts}

\description{
Reduce the size of Poisson-like counts by binomial thinning.
}

\usage{thinCounts(x, prob=NULL, target.size=min(colSums(x)))}

\arguments{ 
	\item{x}{numeric vector or array of non-negative integers.}
	\item{prob}{the expected proportion of the events to keep. Either a unit vector or of same length as \code{x}.}
	\item{target.size}{the desired total column counts. Either a unit vector or of the same length as \code{NCOL{x}}.
	Must be not greater than column sum of \code{x}. Ignored if \code{prob} is not \code{NULL}.}
}

\value{
A vector or array of the same dimensions as \code{x}, with thinned counts.
}

\details{
If \code{prob} is not \code{NULL}, then this function calls \code{rbinom} with \code{size=x} and \code{prob=prob} to generate the new counts.
This is classic binomial thinning.
The new column sums are random, with expected values determined by \code{prob}.

If \code{prob} is \code{NULL}, then this function does multinomial thinning of the counts to achieve specified column totals.
The default behavior is to thin the columns to have the same column sum, equal to the smallest column sum of \code{x}.

If the elements of \code{x} are Poisson, then binomial thinning produces new Poisson random variables with expected values reduced by factor \code{prob}.
If the elements of each column of \code{x} are multinomial, then multinomial thinning produces a new multinomial observation with a reduced sum.
}

\author{Gordon Smyth}

\examples{
x <- rpois(10,lambda=10)
thinCounts(x,prob=0.5)
}

\concept{Data exploration}