Re: Integrate the Multivariate normal distribution
- To: mathgroup at smc.vnet.net
- Subject: [mg67466] Re: [mg67451] Integrate the Multivariate normal distribution
- From: "Miguel Lejeune" <mlejeune at andrew.cmu.edu>
- Date: Mon, 26 Jun 2006 00:54:17 -0400 (EDT)
- References: <31541561.1151237675216.JavaMail.root@eastrmwml07.mgt.cox.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thank you Bob. I have one more question, also related to the bivariate normal distribution. I would like to compute (numerically) the following integrale (PDF is the probability density function of the bivariate normal distribution): Integrale of [PDF[ndist, {x1, x2}] with respect to x2 (dx2) and the integration bounds are -Infinity and 1. with ndist = MultinormalDistribution[{0, 0}, r]; r = {{1, 0.2}, {0.2, 1}}; Could you indicate me how I should do? Many thanks, Miguel ----- Original Message ----- From: "Bob Hanlon" <hanlonr at cox.net> To: mathgroup at smc.vnet.net Subject: [mg67466] Re: [mg67451] Integrate the Multivariate normal distribution > You need to load the package. > > Off[General::spell1]; > > Needs["Statistics`MultinormalDistribution`"]; > > r={{1,0.2},{0.2,1}}; > > ndist=MultinormalDistribution[{0,0},r]; > > pdf=PDF[ndist,{x1,x2}] > > 0.16243683359034922* > E^((1/2)*((-x1)*(1.0416666666666667*x1 - > 0.20833333333333337*x2) - > x2*(1.0416666666666667*x2 - 0.20833333333333337*x1))) > > ContourPlot[pdf,{x1,-2,2},{x2,-2,2}]; > > NIntegrate[CDF[ndist,{x1,x2}], > {x1,-Infinity,0},{x2,-Infinity,0}] > > 0.212349 > > > Bob Hanlon > > ---- Miguel Lejeune <mlejeune at andrew.cmu.edu> wrote: >> Hello, >> >> I am using the MultiNormal function to compute the probability density >> function (pdf_ and cumulative probability distribution (cdf) of a >> bivraite normally distributed variable. >> >> I have two questions. >> >> 1) I followed the help file to get familiar with that function. >> But although I repeat what is indicated, I do not obtain the same >> output. Could you please indicate me? >> Example: >> >> In: Statistics`MultinormalDistribution >> In: (r = {{1, 0.2}, {0.2, 1}}; >> ndist = MultinormalDistribution[{0, 0}, r]) >> >> I obtain as output: >> Out: MultinormalDistribution [ {{0, 0}, {1, 0.2}, {1,0.2, 1}}] >> which is fine. >> >> However, when I type: >> >> In: pdf = PDF[ndist, {x1, x2}] >> >> The only output I obtain is: >> MultinormalDistribution[{0, 0}, {{1, 0.2}, {1, 0, 2}}] >> >> while in the help file it is indicated that I should obtain an >> algebraic expression. >> >> Why is it?? >> >> >> 2) My second question. I would like to proceed to the numerical >> integration of the CDF of the bivariate normal distribution. I enter: >> >> In: NIntegrate[CDF[ndist, {x1, x2}], {x1, -Infinity, 0}, >> {x2,-Infinity, 0}] >> >> I systematically obtain the following error message: >> >> "NIntegrate::inum: Integrand CDF[MultinormalDistribution[{0, 0}, >> {{1,0.5}, \ >> {1, 0, 5}}], {x1, x2}] is not numerical at {x1, x2} = {-1., -1.} >> " >> I do not understand why it is saying that the expression is not >> numerical at {-1,1}. Could anybody help? >> >> >> >> Many thanks, >> >> >> >> Miguel >> >> > > >