MarioniLab / RegressionBASiCS2017

Analysis code for Nils and Catalina's regression extension
5 stars 2 forks source link

A query about the output #2

Closed WT215 closed 5 years ago

WT215 commented 5 years ago

Hi,

For BASiCS_MCMC function, does 1/Chain1@parameters$delta[1000,] correspond to the size parameter in rnbinom?

Because I found that that value is very similar to the size used in simulation, where the model used in simulation is Gamma+Poisson or equally Negative Binomial.

Thank you very much!

Best wishes, Wenhao

catavallejos commented 5 years ago

Hi Wenhao,

Are you talking about a specific part of the code? If so, could you please point us to it?

In terms of rnbinom, please note that it uses a parametrisation based on independent Bernoulli trials (each of them with probability of success equal to p) where the random variable represents the number of trials until size successes are observed. Most (single-cell) RNAseq models that are based on a negative binomial distribution use a different parameterisation: in terms of a mean parameter mu and an over-dispersion parameter delta. The latter is usually derived from a Gamma-Poisson mixture. You can map size and p to mu and delta.

Said this, please note that the model underlying BASiCS is not a negative binomial distribution in itself (although the motivation is similar). Instead, we assume hierarchical model in which some fixed effects (normalisation) and two random effects (technical and biological over-dispersion) are introduced through the Poisson mean parameters. If what you are looking for is a way to simulate data from the BASiCS model, I'd recommend you to use the BASiCS_Sim function.

Please do let me know if I did not answer the correct question!

Best

Cata

WT215 commented 5 years ago

Hi @catavallejos,

Thank you for your reply!

I am looking at the Equation 19 in the paper "Correcting the Mean-Variance Dependency for Differential Variability Testing Using Single-Cell RNA Sequencing Data". It seems that $1/delta$ of Neg-Bin is the dispersion parameter of Negative Binomial distribution, am I correct?

Thank you very much!

Best, Wenhao

catavallejos commented 5 years ago

Hi @WT215,

Sorry for the confusion. In Equation 19, the negative binomial is parametrised as in rnbinom (i.e. $1/\delta$ does indeed correspond to size. You can see this more clearly in the likelihood that is shown in Equation 20.

Please note, however, that the full model treats $\nu_j$ as a random effect and therefore the final model is not a negative binomial distribution in itself. If you want to see what's the role of $\delta_i$ in the final model, the best would be to look at Equation 5 here.

I hope that helps.

Best

Cata

WT215 commented 5 years ago

Thank you for your quick reply @catavallejos ! This helps a lot!

Best Wenhao

catavallejos commented 5 years ago

Excellent! I will close the issue for now.