Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Integrate the Multivariate normal distribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67456] Re: [mg67451] Integrate the Multivariate normal distribution
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Mon, 26 Jun 2006 00:12:57 -0400 (EDT)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

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
> 
> 


  • Prev by Date: Re: Quaternion problem
  • Next by Date: RE: How can I graph 3D vectors in Mathematica?
  • Previous by thread: Re: Quaternion problem-> conversion
  • Next by thread: Re: Integrate the Multivariate normal distribution