MathGroup Archive 2011

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

Search the Archive

Re: MultinormalDistribution Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120291] Re: MultinormalDistribution Question
  • From: Steve <s123 at epix.net>
  • Date: Sun, 17 Jul 2011 06:02:34 -0400 (EDT)
  • References: <201107100901.FAA24634@smc.vnet.net> <ivel76$89d$1@smc.vnet.net>

On Jul 11, 7:01 am, Andrzej Kozlowski <a... at mimuw.edu.pl> wrote:
> First, your covariance matrix is not symmetric definite. I think you prob=
ably meant:
>
> CapSigma = {{sigma1^2, rho*sigma1*sigma2}, {rho*sigma1*sigma2,
>    sigma2^2}}
>
> Assuming that, you can get the conditional expectation from the definitio=
n:
>
> Integrate[y PDF[dist, {6.3, y}], {y, -Infinity, Infinity}]/
>  PDF[MarginalDistribution[dist, 1], 6.3]
>
> 5.6
>
> Alternatively, you can use Mathematica 8 built in NExpectation function:
>
> NExpectation[y \[Conditioned] 6.299 <= x <= 6.301, {x, y} \[Distribut=
ed] dist]
> 5.6
>
> Once you have the conditional expectation, you can compute the conditiona=
l variance, e.g.
>
>  Chop[Integrate[(y - 5.6)^2*PDF[dist, {6.3, y}], {y, -Infinity, Infinit=
y}]/PDF[MarginalDistribution[dist, 1], 6.3]]
>  0.0256
>
> Andrzej Kozlowski
>
> On 10 Jul 2011, at 11:01, Steve wrote:
>
>
>
> > Hello,
>
> > Can someone help me with this ?
>
> > I have 2 normal distributions; dist1 describes x and dist2 describes
> > y. Each are fully defined and are correlated to one another by the
> > correlation coefficient. How can I detemine the mean and standard
> > deviation of the expected normal distribution that is associated with
> > a given x value from dist1 ?
>
> > An example:
> > mean1 = 5.8
> > sigma1 =0 .2
>
> > mean2 = 5.3
> > sigma2 = 0.2
>
> > Correlation Coefficient, rho = 0.6
>
> > Given an x value of 6.3 (from dist1) what is the corresponding mean
> > and standard deviation of y ?
>
> > I can view the combined density function from the following:
>
> > Mu = {mean1, mean2}
> > CapSigma = {{sigma1^2, rho*sigma1*sigma2} , {rho,  rho*sigma1*sigma=
2}
> > dist = MultinormalDistribution[Mu,CapSigma]
> > pdf = PDF[dist,{x,y}]
> > plot1 = Plot3D[pdf, {x,4,7},{y,4,7}, PlotRange->All]
>
> > but can't see how to determine the mean and the standard deviation of
> > y for a given value of x, like 6.3
>
> > Any help would be appreciated.
>
> > Thanks,
>
> > --Steve- Hide quoted text -
>
> - Show quoted text -

Many thanks to all that responded to my question.

I apologize for the errors in my original post. I hadn't yet figured
out how to copy and paste Mathematica code into Usenet posts in a way
that is human readable, I therefore hand-typed my original post which
introduced typographical errors. Hopefully I can do better with this
and future posts.

The example problem of my original post came from a textbook on
mathematical statistics where their solution is mean = 5.6 and stddev
= 0.16

Andrzej Kozlowski's posting was particularly useful to me as it
confirmed the textbook solution and showed how I might generalize this
analysis to other situations. Below is my understanding of his
solution.

mean1 = 5.8;
sigma1 = .2;
mean2 = 5.3;
sigma2 = .2;
rho = .6;
mu = {mean1, mean2};
capsigma = {{sigma1^2, rho*sigma1*sigma2}, {rho*sigma1*sigma2,
sigma2^2}};
dist1 = MultinormalDistribution[mu, capsigma];
In[9]:= x1 = 6.3;
conditionalpdf = PDF[dist1, {x1, y}];
a = Integrate[y*conditionalpdf, {y, -Infinity, Infinity}]  ;
marginaldistribution = MarginalDistribution[dist1, 1];
b = PDF[marginaldistribution, x1] ;
mux2 = a/b;
c = Integrate[(y - mux2)^2*PDF[dist1, {x1, y}], {y, -Infinity,
    Infinity}];
sigmax2 = Sqrt[Chop[c/b]];
{mux2, sigmax2}
Out[18]= {5.6, 0.16}

What I really need to do is perform this analysis on test data for
which I have only a few data points, hence the Student T distribution
would be more appropriate than the Normal distribution. Secondly,
values for the "independent" and "dependent" variables have no
physical meaning below zero. So this implies that I need truncated
distributions. I'm hoping that the solution Andrzej  provided can be
generalized for these added complications.
Here are my 9 {F,t} data points where "F" is considered "independent"
and t considered "dependent".

{{1.01041, 0.3152}, {10.455, 0.3386}, {17.9032, 0.2534}, {24.9581,
   0.5412}, {26.4688, 0.3251}, {27.4651, 0.4428}, {30.1682,
   0.3402}, {36.6174, 0.2106}, {45.6129, 0.2154}}

Would someone be so kind as to plop this data into their notebook to
confirm a solution or two for me ? My results are below which are
based on truncating the Student T distribution, 8 degrees of freedom
and a calculated rho of -0.2327.

If F=1.0,    the probability of t exceeding 0.5 is 18.24%
If F=10.0,  the probability of t exceeding 0.5 is 13.17%
If F.0,   the probability of t exceeding 0.5 is 9.24%
If F=24.52,  the probability of t exceeding 0.5 is 8.11%
If F=30.0,   the probability of t exceeding 0.5 is 7.20%
If F=40.0,  the probability of t exceeding 0.5 is 6.55%

While working this, I came upon some integration problems and needed
to increase MaxRecursion to 20
Thanks in advance,
--Steve


  • Prev by Date: Re: Solve never calls Equal?
  • Next by Date: Re: Solve never calls Equal?
  • Previous by thread: Re: MultinormalDistribution Question
  • Next by thread: Re: MultinormalDistribution Question