Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Multivariate Logistic Distribution

Subject: Multivariate Logistic Distribution

From: LG G

Date: 17 Sep, 2010 15:00:21

Message: 1 of 7

Dear MatLab Users,

I need to generate 4 vectors (nx1) of correlated error tems that are marginally logistic distributed, with the following (constant) means: mu1, mu2, mu3, and mu4 and a 4x4 correlation matrix:
SIGMA=[mu1(1-mu1) -mu1mu2 -mu1mu3 -mu1mu4;
-mu2mu1 mu2(1-mu2) -mu2mu3 -mu2mu4;
-mu3mu1 -mu3mu2 mu3(1-mu3) -mu3mu4;
-mu4mu1 -mu4mu2 -mu4mu3 mu4(1-mu4);];.

I know that the mvnrnd command in MatLab generates correlated random variables that are marginally normally distributed, but I can't find a command for the multivariate logistic distribution. Is there a command or an alternative way to generate this data in MatLab?

I really appreciate your help.

Thank you,
LG

Subject: Multivariate Logistic Distribution

From: Frank

Date: 17 Sep, 2010 15:35:04

Message: 2 of 7

You can try approximating the logistic with a normal. They are both
similar. They will have the same mean, but the logistic can be
approximated from a normal by assuming the variance of the normal is
(pi^2)/3. You can use this to adjust the scale parameter for your
logistic distribution. For example, if you logistic scale parameter is
10, then you can approximate this by using a normal distribution with
a variance of (10^2 * pi^2)/3.

Frank

Subject: Multivariate Logistic Distribution

From: LG G

Date: 17 Sep, 2010 20:23:08

Message: 3 of 7

Frank <fbleahy@yahoo.com> wrote in message <22aae3e1-43a7-4295-b8ad-10ead14a0c2f@j5g2000vbg.googlegroups.com>...
> You can try approximating the logistic with a normal. They are both
> similar. They will have the same mean, but the logistic can be
> approximated from a normal by assuming the variance of the normal is
> (pi^2)/3. You can use this to adjust the scale parameter for your
> logistic distribution. For example, if you logistic scale parameter is
> 10, then you can approximate this by using a normal distribution with
> a variance of (10^2 * pi^2)/3.
>
> Frank

Hello Frank,

Thank you for your promt response. I understand that the normal and the logistic distribution are very similar, the diffence being that the logistic has heavier tails. I also understand where the adjustment that your suggested is coming from, but I am not very clear about how it exacty affects the whole variance-covariance matrix above. Is the same adjustment applied to both variance and covariance terms? To be more specific, if I need a multivariate logistic random variable with the following variance-covariance matrix (mu's are just constants):

SIGMA=[mu1(1-mu1) -mu1mu2 -mu1mu3 -mu1mu4;
-mu2mu1 mu2(1-mu2) -mu2mu3 -mu2mu4;
-mu3mu1 -mu3mu2 mu3(1-mu3) -mu3mu4;
-mu4mu1 -mu4mu2 -mu4mu3 mu4(1-mu4);];

but instead, I generate a multivariate normal random variable as an approximation, what would it be the adjusted variance-covariance matrix to be used with the multivariate normal distribution?

Thank you so much for your help.

LG

Subject: Multivariate Logistic Distribution

From: Frank

Date: 17 Sep, 2010 22:34:02

Message: 4 of 7

Good question. I would think you would just multiply the whole matrix
by (pi^2)/3.....i.e., (pi^2)/3 * SIGMA. Give that a try and see if you
get reasonable results.

Subject: Multivariate Logistic Distribution

From: Peter Perkins

Date: 18 Sep, 2010 00:09:26

Message: 5 of 7

On 9/17/2010 11:00 AM, LG G wrote:
> I need to generate 4 vectors (nx1) of correlated error tems that are
> marginally logistic distributed, with the following (constant) means:
> mu1, mu2, mu3, and mu4 and a 4x4 correlation matrix:
> SIGMA=[mu1(1-mu1) -mu1mu2 -mu1mu3 -mu1mu4; -mu2mu1 mu2(1-mu2) -mu2mu3
> -mu2mu4; -mu3mu1 -mu3mu2 mu3(1-mu3) -mu3mu4; -mu4mu1 -mu4mu2 -mu4mu3
> mu4(1-mu4);];.

I'm assuming you do not mean "multinomial logistic regression" here,
i.e., MNRFIT, but rather a single distribution in the spirit of, as you
say, MVNRND. I would think MVTRND would be the first thing to turn to
as an approximation, not MVNRND, though.

A google search of "multivariate logistic distribution" turns up an old
paper that I am not familiar with.

It is certainly also possible to use a Gaussian or t copula, i.e.,
COPULARND, with logistic marginal distributions. There is a demo and a
Statistics Toolbox User Guide section that describes this kind of
scheme. However, you will likely have to abandon any hope of matching a
linear correlation matrix, and settle instead for matching a rank
correlation matrix.

Hope this helps.

Subject: Multivariate Logistic Distribution

From: LG G

Date: 18 Sep, 2010 11:42:04

Message: 6 of 7

Peter Perkins <Peter.Perkins@MathRemoveThisWorks.com> wrote in message <i70vvm$q7u$1@fred.mathworks.com>...
> On 9/17/2010 11:00 AM, LG G wrote:
> > I need to generate 4 vectors (nx1) of correlated error tems that are
> > marginally logistic distributed, with the following (constant) means:
> > mu1, mu2, mu3, and mu4 and a 4x4 correlation matrix:
> > SIGMA=[mu1(1-mu1) -mu1mu2 -mu1mu3 -mu1mu4; -mu2mu1 mu2(1-mu2) -mu2mu3
> > -mu2mu4; -mu3mu1 -mu3mu2 mu3(1-mu3) -mu3mu4; -mu4mu1 -mu4mu2 -mu4mu3
> > mu4(1-mu4);];.
>
> I'm assuming you do not mean "multinomial logistic regression" here,
> i.e., MNRFIT, but rather a single distribution in the spirit of, as you
> say, MVNRND. I would think MVTRND would be the first thing to turn to
> as an approximation, not MVNRND, though.
>
> A google search of "multivariate logistic distribution" turns up an old
> paper that I am not familiar with.
>
> It is certainly also possible to use a Gaussian or t copula, i.e.,
> COPULARND, with logistic marginal distributions. There is a demo and a
> Statistics Toolbox User Guide section that describes this kind of
> scheme. However, you will likely have to abandon any hope of matching a
> linear correlation matrix, and settle instead for matching a rank
> correlation matrix.
>
> Hope this helps.

Hello Peter,

Thank you so much for all your suggestions.

LG

Subject: Multivariate Logistic Distribution

From: Tom Lane

Date: 27 Sep, 2010 17:59:29

Message: 7 of 7

> I need to generate 4 vectors (nx1) of correlated error tems that are
> marginally logistic distributed, with the following (constant) means: mu1,
> mu2, mu3, and mu4 and a 4x4 correlation matrix:
> SIGMA=[mu1(1-mu1) -mu1mu2 -mu1mu3 -mu1mu4; -mu2mu1
> mu2(1-mu2) -mu2mu3 -mu2mu4; -mu3mu1 -mu3mu2
> mu3(1-mu3) -mu3mu4; -mu4mu1 -mu4mu2 -mu4mu3 mu4(1-mu4);];.

LG, I don't know if linear combinations of logistic variables are themselves
logistic. I suspect they are not. But just in case you are not too strict
about wanting what you describe, here's something you could do. First you
might generate some standard multivariate logistic random variables.
According to wikipedia, the variance of the logistic distribution is 3/pi^2,
so I adjust to have a theoretical variance of 1.

>> z = (sqrt(3)/pi) * random('logistic',0,1,10000,3);
>> cov(z)
ans =
    1.0049 0.0030 -0.0256
    0.0030 0.9854 0.0081
   -0.0256 0.0081 0.9918

Then you could multiply the matrix by the Cholesky factor of your desired
covariance. The covariance of the result is close to the desired theoretical
value.

>> C = [10 -2 3;-2 5 0;3 0 1];
>> y = z*chol(C);
>> cov(y)

ans =

   10.0494 -1.9895 3.0055
   -1.9895 4.9266 -0.0012
    3.0055 -0.0012 0.9982

Finally, you could add the desired mean. But again, I suspect y isn't really
a multivariate logistic.

I notice that the form of your SIGMA matrix is the form of the covariance
matrix for a four-leveled multinomial random variable. That probably means
the matrix is rank deficient. So calling the chol function won't work and
you'd have to try something else. I could suggest something if you were
interested.

But I really am wondering if I understand the problem. Sometimes multinomial
random variables are modeled with logistic regression, and they will have a
covariance matrix of the form that you describe. But it's not this, but the
multivariate logistic distribution, that you want?

-- Tom

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us