The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Average and SEM in Matrix
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

luismramirezr

Brazil
7 Posts

Posted - 10/03/2015 :  11:00:53 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2015
Operating System: Windows 10


Hi,

I have 9 matrices with 8 columns and 6 rows. Each cell corresponds to the same cell in the other matrices.

What I want is to create 2 new matrices, one with the average result of each cell and the other one with the SEM.

I know I can do this like

(Mat(1)+Mat(2)+(Mat(3)+Mat(4)+Mat(5)+Mat(6)+Mat(7)+Mat(8)+Mat(9))/9)


for example, but what if i have like 100 matrices??

Is there an easier way? Isn't there an option like "Statistics on Columns/Rows"?

Thank you,

Luis

Hideo Fujii

USA
1582 Posts

Posted - 10/06/2015 :  11:38:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Luis,

Here is probably the least script involved procedure for many matrices to calculate
the mean and SE at each cell position:

We assume that all matrices are stored in matrix objects in a matrix sheet in a matrix.

1) "Matrix Set Dimension/Labels" menu. Change the matrix size with 1 column and NxM rows,
e.g., when originally 8 columns by 6 rows, you set them as 1 column by 48 rows.
Also, turn ON "Rearranged" radio button for "Data will be" option.
==> Every matrix becomes 1-column format.

2) Run the following script to copy all matrices into the columns in a worksheet:
(In this sample, the matrix is in MBook1, worksheet is in Book1)
for(ii=1; ii<=MBook1!wks.nmats; ii++) {
  range mm=[MBook1]1!$(ii);
  range ww=[Book1]1!wcol(ii);
  ww=mm;
}
3) Highlight all columns in the worksheet, and seelect "Statistics: Descriptive Stats: Stats on Rows" menu.
Turn ON Mean and SE of mean check boxes under Quantities to Compute branch.

4) Add 2 new matrix objects in the matrix, and copy-and-paste the Mean column into the first added matrix object.
Do the same for the the SE column.

5) Reconvert the matrices back to NxM dimensions - select "Matrix Set Dimension/Labels" menu,
turn ON "Rearranged" radio button for "Data will be" option.

Note that one matrix sheet in a matrix book can contain 65527 matrix objects!

--Hideo Fujii
OriginLab
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000