[Scilab-users] n dimensional normal distribution
Samuel Gougeon
sgougeon at free.fr
Mon Mar 19 20:51:21 CET 2018
Hello Masahiro,
Le 18/03/2018 à 17:31, fujimoto2005 a écrit :
> Let x1, x2, .., xn be an random variable of n dimensional normal
> distribution. Is there any function that gives the probability of {x1> =
> k1}&{x2> = k2}&...&{xn> = kn}?
I thougth at the first sight that it would be possible to get this
probability with some lexicographic sorting, but it's not the case. I
don't thing that we can avoid an explicit loop. Here is a possible
direct calculation, from a list of actual samples :
ns = 20; // number of samples
nd = 3; // number of dimensions
k = [5 3 7];
m = grand(ns,nd,"nor",8,3)
for i = 1:nd
[?,r] = gsort(m(:,i));
m = m(r,:);
m = m(find(m(:,i)>=k(i)),:)
end
p = size(m,1)/ns // requested probability
Example of run :
m =
12.750144 7.1200267 5.900484
12.575508 5.410083 10.976422
12.399993 3.7475677 10.092495
12.220889 5.4940195 6.1479044
12.158487 5.2062957 11.651957
11.611694 6.6661928 5.9750098
10.718146 2.2454739 11.737011
10.343892 4.2714818 4.7199587
9.9907016 7.7903253 5.9802778
8.3135823 4.8094984 7.1769228
8.0939865 9.2484944 13.215993
8.0098652 3.0198012 7.5767533
7.5354006 10.715856 8.985266
7.4971339 17.821625 5.5456382
6.6502306 8.7791304 8.812858
6.5728805 12.299302 7.9823783
6.2940806 10.376389 7.8221558
5.2862072 6.0566186 11.102784
m =
7.4971339 17.821625 5.5456382
6.5728805 12.299302 7.9823783
7.5354006 10.715856 8.985266
6.2940806 10.376389 7.8221558
8.0939865 9.2484944 13.215993
6.6502306 8.7791304 8.812858
9.9907016 7.7903253 5.9802778
12.750144 7.1200267 5.900484
11.611694 6.6661928 5.9750098
5.2862072 6.0566186 11.102784
12.220889 5.4940195 6.1479044
12.575508 5.410083 10.976422
12.158487 5.2062957 11.651957
8.3135823 4.8094984 7.1769228
10.343892 4.2714818 4.7199587
m =
8.0939865 9.2484944 13.215993
12.158487 5.2062957 11.651957
5.2862072 6.0566186 11.102784
12.575508 5.410083 10.976422
7.5354006 10.715856 8.985266
6.6502306 8.7791304 8.812858
--> p = size(m,1)/ns // requested probability
p =
0.3
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180319/2aad9667/attachment.htm>
More information about the users
mailing list