MathGroup Archive 2003

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

Search the Archive

Re: Re: Multivariate-T Simulation Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg39013] Re: Re: [mg38986] Multivariate-T Simulation Problem
  • From: Dr Bob <drbob at bigfoot.com>
  • Date: Fri, 24 Jan 2003 05:07:01 -0500 (EST)
  • References: <20030123230524.63383.qmail@web13802.mail.yahoo.com>
  • Sender: owner-wri-mathgroup at wolfram.com

You might want to use VarianceTest to give a measure of how far off the 
sample variance is.  Without something like this, "the sample variance is 
wrong" doesn't mean anything.

NS = 2;
df = 20; rS0 = RandomArray[UniformDistribution[-0.30, 0.80], {NS, NS}];
rS0 = rS0.Transpose[rS0];
rS0 = (rS0/Max[rS0]) (1 - IdentityMatrix[NS]) + IdentityMatrix[NS];
rS0
ET = Transpose[RandomArray[MultivariateTDistribution[rS0, df], 10000]];
ST = N[CovarianceMatrix[MultivariateTDistribution[rS0, df]]]
VarianceTest[Transpose@ET, 20/(20 - 2), TwoSided -> True, FullReport -> 
True]

{{1, 0.0799201}, {0.0799201, 1}}
{{1.11111, 0.0888001}, {0.0888001, 1.11111}}
{FullReport -> TableForm[
    {{{1.0781668250596432, 1.083761196394562}, {9702.531075394236, 
9752.875382474302}, ChiSquareDistribution[
       9999]}}, TableHeadings -> {None, {"Variance", "TestStat", 
"Distribution"}}], TwoSidedPValue -> {0.03461648205760730982340\
84515`10.8823, 0.080081080822\
4253545167676788`10.8566}}

Bobby

On Thu, 23 Jan 2003 23:05:24 +0000 (GMT), Kyriakos Chourdakis 
<tuxedomoon at yahoo.com> wrote:

> Dr. Bob,
>
> It is true that anything can happen once, but this is
> not the case since it is happening consistently.
>
> In any way, when a sample of 10000 is drawn and the
> degrees of freedom is so high [making all first
> moments to exist and implying near normality], one
> should not be so unlucky and get both variances wrong.
>
> I am starting to think about the bug scenario...
> I am using version 4.0 on WinME. If anyone with
> similar specs could try it I would be grateful.
>
> To find a path around the problem, I could try to use
> univariate t-random numbers [which work fine] to
> create the multivariate series, but I am not sure how.
> Is the standard
>
> X = rho Y + sqrt(1-rho^2) W
>
> trick working when Y and W are [standardized]
> t-distributed with df degrees of freedom ? My guess is
> not since t=sqrt(Z1^2+...+Zdf^2). What would be the
> correct way?
>
> Best,
>
> Kyriakos
>
> ====> Dr. Bob wrote <====
> It's a SAMPLE variance, so almost anything can happen
> ONCE.
>
> I'm not getting sample variances anything like that,
> though, so there could
> be a bug in your version of Mathematica.  I'm using
> version 4.2 with WinXP.
>
> Also, you may as well look at the simulated covariance
> matrix,
> CovarianceMatrix@Transpose@ET, rather than just the
> variance.
>
> Bobby
>
> On Thu, 23 Jan 2003 08:05:54 -0500 (EST),
> KyriakosChourdakis
> <tuxedomoon at yahoo.com> wrote:
>
>> Dear all,
>>
>> I am trying to simulate a multivariate
> t-distribution,
>> and encounter the following problem:
>>
>> (* First load the packages *)
>> <<Statistics`MultinormalDistribution`
>> <<LinearAlgebra`MatrixManipulation`
>>
>> NS = 2; (* the number of series *)
>> df = 20; (* the degrees of freedom - Since the
> number
>> is large, it should make the t similar to a normal
> *)
>>
>> (* Create a random variance-covariance matrix *)
>> rS0 = RandomArray[UniformDistribution[-0.30,
>> 0.80],{NS, NS}];
>> rS0 = rS0.Transpose[rS0];
>> rS0 = (rS0/Max[rS0]) (1 - IdentityMatrix[NS]) +
> IdentityMatrix[NS];
>>
>> (* the var-covar matrix is *)
>> rS0
>> {{1,         -0.290755},
>> {-0.290755, 1        }}
>>
>> (* create 10000 draws of 2 dimensional vectors *)
>> ET =
>> Transpose[RandomArray[MultivariateTDistribution[rS0,
>> df], 10000]];
>>
>> (* the theoretical cov matrix is ok, with
>> var=df/[df-2]... *)
>> ST =
> N[CovarianceMatrix[MultivariateTDistribution[rS0,
>> df]]]
>> {{1.11111,  -0.323061}, {-0.323061,  1.11111}}
>>
>> (* ... But the simulated variance is not*)
>> Mean /@ ET
>> Variance /@ ET
>> {-0.00426186, 0.00824351}
>> {0.067534, 0.0670659}
>>
>> (* On the other hand, if I draw from the
> corresponding
>> multinormal *)
>> EN =
> Transpose[RandomArray[MultinormalDistribution[{0,
>> 0}, ST], 10000]];
>>
>> (* Everything is OK *)
>> Mean /@ EN
>> Variance /@ EN
>> {0.0196956, -0.00675908} (* Should be 0 *)
>> {1.1362, 1.1099}         (* Should be 1.111 *)
>>
>> I cannot understand why the simulated variance is
>> 0.067 instead of 1.111/[20-2]. Alternatively, why
>> should I multiply all values with
> sqrt(1.111/0.067)=4.
>>
>> Best,
>>
>> Kyriakos
>>
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Everything you'll ever need on one web page
>> from News and Sport to Email and Music Charts
>> http://uk.my.yahoo.com
>>
>>
>
>
>
> --
> majort at cox-internet.com
> Bobby R. Treat
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>



-- 
majort at cox-internet.com
Bobby R. Treat



  • Prev by Date: Re: Multivariate-T Simulation Problem
  • Next by Date: Re: Lower Floor
  • Previous by thread: Re: Multivariate-T Simulation Problem
  • Next by thread: Lower Floor