# How to generate binomial data with set probability and covariation

3 vues (au cours des 30 derniers jours)
Johan le 15 Avr 2014
Hello Everybody,
Im having a question regarding a data simulation problem that Im having. I have neuronal network data where each neuron has a set firing probability per event (for instance p1 = 0.2 but p2 = 0.3). In addition some neurons are more likely to fire together then others so they have a set correlation or covariation. How can I generate random events where the results will (loosely) fit the previously observed propability distribution and covariation matrix?
I see that mvnrnd can generate such data with a normal distribution but I need binomial output (All-or-none firing). Does anybody know how to accomplish this? Really any suggestions will be helpfull!
Thank you in advance!
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Réponses (1)

Alberto le 15 Avr 2014
You can generate values uniformily on [0,1], lets suppose you want to generate 100 random binomial numbers:
N=100;
x=rand(1,N);
lets suppose your 'success' probability es p=0.7:
p=0.7;
So, your binomial sample of 1 or 0 are:
bin= x>p;
But if you are interested in multivariates samples with a given correlation, you need copulas and copularnd command.
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Probability Distributions dans Help Center et File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by