Thread Subject: Problem 4d matrix irf

Subject: Problem 4d matrix irf

From: Wildo

Date: 4 Feb, 2012 04:04:13

Message: 1 of 3

I have a 4d matrix irf(t,draw,var,lag), where t is time (173), draw(500) is a draw from a gibbs sampling, var(3) is a variable, and lag(21) is a lag. So the size of the matrix is 173x500x3x21.

But I need to convert it to a 3d matrix, where I want the mean of the 500x3x21 part converting to a 3x21 matrix, and put it in a 173x3x21.

How can I do this?

Subject: Problem 4d matrix irf

From: John D'Errico

Date: 4 Feb, 2012 04:32:15

Message: 2 of 3

"Wildo " <wildogonzalez@yahoo.com> wrote in message <jgians$abk$1@newscl01ah.mathworks.com>...
> I have a 4d matrix irf(t,draw,var,lag), where t is time (173), draw(500) is a draw from a gibbs sampling, var(3) is a variable, and lag(21) is a lag. So the size of the matrix is 173x500x3x21.
>
> But I need to convert it to a 3d matrix, where I want the mean of the 500x3x21 part converting to a 3x21 matrix, and put it in a 173x3x21.
>
> How can I do this?

Why do I think that the function mean would be a
good start?

Of course, you might decide then that a 173x1x3x21
array was not what you wanted. So then if you think
about it, how could you use reshape to help here?

If that is more than you want, a little search might
find squeeze for you.

John

Subject: Problem 4d matrix irf

From: TideMan

Date: 4 Feb, 2012 20:14:41

Message: 3 of 3

On Feb 4, 5:32 pm, "John D'Errico" <woodch...@rochester.rr.com> wrote:
> "Wildo " <wildogonza...@yahoo.com> wrote in message <jgians$ab...@newscl01ah.mathworks.com>...
> > I have a 4d matrix irf(t,draw,var,lag), where t is time (173), draw(500) is a draw from a gibbs sampling, var(3) is a variable, and lag(21) is a lag. So the size of the matrix is 173x500x3x21.
>
> > But I need to convert it to a 3d matrix, where I want the mean of the 500x3x21 part converting to a 3x21 matrix, and put it in a 173x3x21.
>
> > How can I do this?
>
> Why do I think that the function mean would be a
> good start?
>
> Of course, you might decide then that a 173x1x3x21
> array was not what you wanted. So then if you think
> about it, how could you use reshape to help here?
>
> If that is more than you want, a little search might
> find squeeze for you.
>
> John

You may think that John means to be mean,
but what he means is you should use mean.
And if you mean to use mean, you should carefully read
help mean

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com