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
 Grouping and Frequency counts in serial dataset
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

zango24

India
Posts

Posted - 08/18/2015 :  09:56:46 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:8.6, windows-7

Hi,
I have a data set, in which there are several numbers. For the example purpose (see below), I have taken numbers from 1 to 50 in which the next number is just an increment of 1 except at certain places where the continuity or seriality is broken. The seriality I am also showing in the form of alphabets for more clarity.

I am interested to have following things:
1) Count how many times the seriality of the data set is broken. In the example, the seriality is broken e.g. 3 times (between a/b; b/c; and c/d).


2) If the seriality is broken then how many groups can be formed with the left over serial data with counts.
e.g. The said data has shown 3 times broken seriality. It means 4 groups of serial data are possible (a-group; b-group; c-group; d-group). In which a-group = 15 counts. b-group = 10 counts; c-group = 5 counts; d-group = 4 counts.

I would like if there is any small script or small code to determine it. As I have a large data set to work with, it would be a great help.

Cheers,
Zan

Example:
1 a
2 a
3 a
4 a
5 a
6 a
7 a
8 a
9 a
10 a
11 a
12 a
13 a
14 a
15 a
21 b
22 b
23 b
24 b
25 b
26 b
27 b
28 b
29 b
30 b
41 c
42 c
43 c
44 c
45 c
47 d
48 d
49 d
50 d

Hideo Fujii

USA
1582 Posts

Posted - 08/18/2015 :  11:37:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi zan,

I assume that your source data doesn't contain the 2nd column, which indicates the group identification,
e.g., a, b, c,... etc.; but contains only the 1st column to be searches the broken sequence segments.

Could you please try the following formula for the Set Column Values tool for the 2nd column?:
((i==1)?1:(col(1)[i]-col(1)[i-1]-1)!=0)?i:col(2)[i-1]
For example, this produces the group identifications which indicate the starting row number of each group; e.g,
1 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 1
10 1
11 1
12 1
13 1
14 1
15 1
21 16
22 16
23 16
24 16
25 16
26 16
27 16
28 16
29 16
30 16
41 26
42 26
43 26
44 26
45 26
47 31
48 31
49 31
50 31

If you need the number of groups and the size of each group, you can simply run the Discrete Frequencies (under "Statistics:
Descriptive Statistics" menu) on the 2nd column.

Hope this helps.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 08/18/2015 11:44:20 AM
Go to Top of Page

zango24

India
Posts

Posted - 08/18/2015 :  1:44:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Many many thanks for your help dear Hideo. You was right in your assumption that I had only one col. And the second column where I wrote alphabets was for clarity purpose to explain what I wanted to do.

One more point. I am unable to follow meanings of some symbols like ? And :. Can you bit elaborate on this side too so that I can try making a small worksheet script which would add bit of automation in data analysis.

Cheers,
Zan
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 08/18/2015 :  3:12:34 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Zan,

---?---:--- is a (ternary) conditional operator as interpreted as:
<Condition>?<RETURN_VALUE_ON_TRUE>:<RETURN_VALUE_ON_FALSE>

See: http://www.originlab.com/doc/LabTalk/guide/Operators#Conditional_Operator_.28.3F:.29

My sample formula has two nested conditions.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 08/18/2015 3:15:33 PM
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