No BSD License
-
DGAnyMarginal(pmfs,Sigma,supp...
[samples,gammas,Lambda,joints2D,hists] = DGAnyMarginal(pmfs,Sigma,supports,Nsamples)
-
EstimateDiscreteJoint(A)
[B,ranges] = EstimateDiscreteJoint(A)
-
PoissonMarginals(means,acc)
% [pmfs,supports] = PoissonMarginals(means,acc)
-
SampleDGAnyMarginal(gammas,La...
[samples,hists]=SampleDGAnyMarginal(gammas,Lambda,supports,Nsamples)
-
[gammas,Lambda,joints2D]=Find...
% [gammas,Lambda,joints2D] = FindDGAnyMarginal(pmfs,Sigma,supports)
-
[samples,gammas,Lambda,joints...
[samples,gammas,Lambda,joints2D,cmfs,hists] = DGPoisson(means,Sigma,Nsamples,acc)
-
[y]=bivnor(a,b,rho)
-
binBinaryToDec(bin)
dec = binBinaryToDec(bin)
-
binHist(S)
-
binHistIndep(mu)
hc = binHistIndep(mu)
-
countElem(x,sv,ev)
-
findLatentGaussian(m,c,acc)
-
sampleCovPoisson(m,C,nSamples...
x = sampleCovPoisson(m,C,nSamples,err)
-
sampleDichGauss01(mu,Sigma,ns...
[s gamma rho] = sampleDichGauss01(mu,Sigma,nsamples,already_computed,acc)
-
vec(v)
-
demo.m
-
setPath.m
-
View all files
from
Sampling from multivariate correlated binary and poisson random variables
by Philipp Berens
These Matlab functions can be used to generate multivariate correlated binary variables, and correl
|
| binHistIndep(mu) |
function hc = binHistIndep(mu)
% hc = binHistIndep(mu)
% Computes expected histogram under independence assumption
% P(X)=PROD(P(x_i))
%
% Code from the paper: 'Generating spike-trains with specified
% correlations', Macke et al., submitted to Neural Computation
%
% www.kyb.mpg.de/bethgegroup/code/efficientsampling
% generate all possible binary patterns
n = size(mu,1);
c = 0:2^n-1;
pattern = zeros(n,size(c,2));
for i=n:-1:1
idx = c>=2^(i-1);
pattern(i,idx)=1;
c(idx) = c(idx) - 2^(i-1);
end
pattern = flipud(pattern);
% transform to probabilities
mu = mu/2+.5;
% find relevant probabilities for independent model
pMat = (repmat(mu,1,size(pattern,2)).*pattern) + (repmat(1-mu,1,size(pattern,2)).* (~pattern));
% calculate histogram
hc = prod(pMat);
|
|
Contact us at files@mathworks.com