I have a support (supp_epsilon
) and a probability mass function (pr_mass_epsilon
) in Matlab, constructed as follows.
supp_epsilon=[0.005 0.01;
0.01 0.015;
0.015 0.02;
0.02 0.025];
suppsize_epsilon=size(supp_epsilon,1);
pr_mass_epsilon=zeros(suppsize_epsilon,1);
mu_epsilon=[0; 0];
sigma_epsilon=[1 0.5; 0.5 1];
pr_mass_epsilon=zeros(suppsize_epsilon,1);
for j=1:suppsize_epsilon
pr_mass_epsilon(j)=mvnpdf(supp_epsilon(j,:),mu_epsilon.',sigma_epsilon)/sum(mvnpdf(supp_epsilon,mu_epsilon.',sigma_epsilon));
end
Note: supp_epsilon
is 4x2
. Each 1x2
row of supp_epsilon
is an element of the support of interest.
Question: I want to draw n=10
vectors of size 1x2
from pr_mass_epsilon
. Each of these vectors has to be a row of supp_epsilon
. For n
very large the empirical frequency of the drawn vectors has to be close to pr_mass_epsilon
.
How can I do this?
Note: This question addresses the scalar case where the answer suggests to use randsample
.
randsample(whatever_it_is,2)
– Gidgetgieepsilon=randsample(supp_epsilon, n, true, pr_mass_epsilon,2)
; – LaganError using randsample (line 74) POPULATION must be a vector.
– Lagann
random vectors. What isn
, and why issupp_epsilon
a matrix and not a vector? – Nutriasupp_epsilon
is now a matrix because it represents the support of a bivariate random vector. Each1x2
row ofsupp_epsilon
is a possible realisation of such bivariate random vector.pr_mass_epsilon
is the associated probability mass function. – Laganarrayfun
? – Skimpmvnpdf
suggests continuous. – Skimpsupp_epsilon
. I construct the probability mass function by truncating and discretising a multivariate normal, but this is just one example. – Lagansum(pr_mass_epsilon) = 1
and it is indeed a PMF, not a PDF. The idea is to develop this for any givenpr_mass_epsilon
, is that right? – Skimp