signed_bernoulli2(N​,p1,p2,r)

Generate and Sample Two Signed Bernoulli Variables with Given Correlation
14 Downloads
Aktualisiert 23. Nov 2017

Lizenz anzeigen

The function first constructs two(2) signed {-1, +1} Bernoulli variables Y_1, Y_2 such that p(Y_1 = -1) = p1, p(Y_2 = -1) = p2, and E[Y_1Y_2] = r. Constraints: 0 < p1,p2 < 1, -1 < r < 1. Next, it draws N realizations of the two variables in Y(m,:), m = 1,2. The sample pdf and cross correlation converge as N -> infinity (obviously).
Example: generate N realizations of variables with mean 0, variance 1, and correlation 0.3: Y = signed_bernoulli2(N,0.5,0.5,0.3).

Zitieren als

Aravindh Krishnamoorthy (2025). signed_bernoulli2(N,p1,p2,r) (https://de.mathworks.com/matlabcentral/fileexchange/65164-signed_bernoulli2-n-p1-p2-r), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2016a
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Frequently-used Algorithms finden Sie in Help Center und MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0