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
 Statistics on rows for non contiguous data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jasonjensen

Ireland
2 Posts

Posted - 02/17/2010 :  1:19:07 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver.8 and Service Release (Select Help-->About Origin):
Operating System:Vista

I was wondering if it is possible to do statistics on rows for non contiguous data?

I have a data set with 20 columns and I would like to get the mean, standard deviation and standard error of the values in certain columns for each row (i.e. the mean the values row1 col 4, row 1 col 8, row 1 col 12 etc...) and then have the statistical values placed in colums at the end of the workbook.

I would like to use the built in statistics tool because some of the values may be blank so using Set Column Values could get tricky.

Also, I know I could move the columns so that they are contiguous, but I have a lot of data generated this way so it would be easier to use the statistics package if possible.

Thanks,

Jason

easwar

USA
1964 Posts

Posted - 02/17/2010 :  3:00:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Jason,

Try this:
1> Hold CTRL key down and click and select desired columns by clicking on header, so you will then end up with only the desired columns selected/highlighted
2> Open script window (menu: Window->Script window) and then copy paste the following line of code and press Enter key:
rowstats mean:=<new> sd:=<new> sem:=<new> n:=<new>;

This will then add new columns for mean, sd etc. You can look up the rowstats X-function for more details.

Does this do what you wanted?

Easwar
OriginLab
Go to Top of Page

jasonjensen

Ireland
2 Posts

Posted - 02/17/2010 :  3:28:19 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That worked perfectly.

Thank you for the fast reply.

Jason
Go to Top of Page

Zisternas

11 Posts

Posted - 02/09/2011 :  08:01:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,



I have the same situation, but my columns are in different sheets of the book. I would like to have statisitcs in rows from columns in different sheets, and if possible to be created in a new sheet inside the book. I have tried the same code and it works fine, but only inside each sheet, how could I modify it?


Thanks in advance!

Madoro
Go to Top of Page

greg

USA
1378 Posts

Posted - 02/09/2011 :  5:17:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You cannot do stats on rows from multiple sheets in the GUI, but it can be done with script:

rowstats irng:=([Book1]Sheet1!B,[Book1]Sheet1!D,[Book2]Sheet3!A,[Book2]Sheet3!C)
mean:=[Results]RowStats!<new name:=Mean>
sd:=[Results]RowStats!<new name:=StdDev>
min:=[Results]RowStats!<new name:=Min>
max:=[Results]RowStats!<new name:=Max>
n:=[Results]RowStats!<new name:=N>;

Above gets stats of columns B and D of Sheet1 in Book1 along with columns A and C of Sheet3 in Book2 and puts the results in a sheet named RowStats in a book named Results.
Go to Top of Page

Zisternas

11 Posts

Posted - 02/10/2011 :  09:20:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Greg,

Thanks for your fast answer.

But I'm having a problem when running the script, it says:

Failed to resolve range string, VarName = irng, VarValue = ([Book61]Sheet1!B,[Book61]Sheet1!D,[Book61]Sheet2!A,[Book61]Sheet3!C)
#Command Error!


I am totally newbie with the Labtalk expressions and I have tried solve it by myself, but I didnt understand the use of irng. Could you help me?
Also I have a question, do I have to write the Long name of the book or the short one, or both are valid? By the way, do the sheets have such a thing like short and long name, or if I rename a sheet I have to indicate this modified name in the code?

Sorry for extending the question, but I don't find these answers in the manuals.

Thanks in advance!
Go to Top of Page

Zisternas

11 Posts

Posted - 02/14/2011 :  1:38:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ok, I have found the reason why it was not working. When I rename books and sheets, the books have still a short name, which is the one to be used in the code, while the sheets are renamed.
So in my case:
rowstats irng:=([Book1]MyName!B,[Book1]MyOthername!D,[Book2]AnotherNweName!A)
mean:=[Results]RowStats!<new name:=Mean>
sd:=[Results]RowStats!<new name:=StdDev>
min:=[Results]RowStats!<new name:=Min>
max:=[Results]RowStats!<new name:=Max>
n:=[Results]RowStats!<new name:=N>;

now is working, thanks greg for the code!

(I write it down in case some other newbie has the same question)
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