Creates a likelihood function for given parameter names

ll(par, namesToOptimise, pulseData, byOne = FALSE)

Arguments

par

a named list with parameter values (including the size parameter for the negative binomial distribution, see dnbinom)

namesToOptimise

names of not fixed parameters

pulseData

a PulseData object

byOne

logical. If TRUE, the created function works on the level of a single gene/isoform. In this case, every gene-specific parameter is representd by a single scalar value. Otherwise, gene-specific parameters are represented by vectors of the length equal to gene number.

Value

a function with the folowing arguments:

  • x, a numeric vector of variable parameters, which is used to calculate the likelihood function. The order of parameters is as in unlist(par)

  • counts, a numeric matrix, or, if byOne is TRUE, a numeric vector with read counts for every sample. If byOne is FALSE (default), number of rows must be equal the number of genes.

  • fixedPars is a list with the rest of parameters which are needed for likelihood calculation. By default, the ones provided in the par argument to ll function are used.

The created function returns a logarithm of the likelihood value calculated on the basis of the negative binomial distribution for the provided counts and parameters.