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
 Generate letters to mark sig.differences in a plot
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

frefrafru

4 Posts

Posted - 06/05/2012 :  10:15:08 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi all, Im new here and have chosen this forum for my question to reach a bride range of people. Im working on my master thesis and need your help to find a solution for my problem to indicate significant differences in a bar chart plot. The data of the statistical test is available in the following format:

Bar1-bar2:significant
Bar1-bar3:not significant


I want to mark significant differences between two bars with different letters (like bar1:a and bar2:b). If there is no significant differences between two bars they get the same letter (like bar1:a and bar3:a). Sort the right letters to the bars gets much more complex when the number of bars increases. I have several hundreds of statistical comparisons here and have to find a computer program that can generate the letters from the data for me.

Anybody an idea which programme can help me?

I have added an example plot with letter-coded significant differences to illustrate what I want to do.

Thanks and greetings from Germany!

Hideo Fujii

USA
1582 Posts

Posted - 06/08/2012 :  3:07:37 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi frefrafru,

Yes, Origin can create such column chart with labels.

Please see the screenshot below. Once you make a (grouped) column chart, you can customize
as usual (e.g., change the Edit Mode to Independent in "Group" tab in Plot Details, then set
the pattern for the dataset, etc. You can find that holding CTRL key lets you move the
individual label's position.)



So far, in the above graph customization you need to put the text labels of significance judgments manually in the label columns (D, G, L, etc.). If you are considering to automatize the label generation, you may need a script; Could you please tell us which kind of statistical test you run to get such judgments (by two-sample t-test between alpha-beta, alpha-gamma, alpha-delta, etc. with alpha as the control group, within each group?)?

Hope this gives you the idea how to make such in Origin.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 06/08/2012 3:37:33 PM
Go to Top of Page

frefrafru

4 Posts

Posted - 06/11/2012 :  04:45:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo Fujii,

thanks for your answer! The visualisation in origin is not the problem. What Im looking for is exactly this script you mentioned. I have 6 or 8 groups (bars) to compare and did this 2-sample t-test for all possible combinations. These are the following ones for a 6 group setup:

bar1-bar2
bar1-bar3
bar1-bar4
bar1-bar5
bar1-bar6
bar2-bar3
bar2-bar4
bar2-bar5
bar2-bar6
bar3-bar4
bar3-bar5
bar3-bar6
bar4-bar5
bar4-bar6
bar5-bar6

For every bar combination a t-test was done and the results (significant difference or no significant difference) is available as an excel sheet. For the case of 8 groups (bars) the list auf possible combinations is longer, of course: 28 comparisons are possible. The figure I add to my first post is such an example with 8 groups (bars). All bars with the same colour belong to the same group. Comparisons within a group are done following the upper scheme.

What I need is a script or program that will generate the letters, which have to be added to every bar to visualize the results of the t-tests.

Is such a script or program available?

Thanks and greetings

Frederik
Go to Top of Page

Sam Fang

293 Posts

Posted - 06/11/2012 :  06:29:46 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
So you can use three letters to represent at most 7 levels. e.g. bar1's label is abc, if bar1-bar2 is no significant difference, then bar2's label is also abc, otherwise it is ab.

But I have one question, for the following case, how to deal with it:
bar1-bar2 no significant difference (bar1 and bar2 have same label)
bar2-bar3 no significant difference (bar2 and bar3 have same label) -> So bar1 and bar3 have same label
bar1-bar3 significant differences (bar1 and bar3 have different labels) -> It conflicted with the above notation.

Sam
OriginLab Technical Services

Edited by - Sam Fang on 06/11/2012 06:45:05 AM
Go to Top of Page

frefrafru

4 Posts

Posted - 06/11/2012 :  08:11:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sam, in the case you mentioned the bars would get the following letters:

Bar1:a
Bar2:a,b
Bar3:b

If there is at least one coinciding letter for two bars the bars are not significantly different. Looks easy but its a lot of work if you have 6 or 8 bars to compare and that several hindered times
Go to Top of Page

frefrafru

4 Posts

Posted - 06/11/2012 :  08:15:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
"hundred times" of course (-;
Go to Top of Page

Sam Fang

293 Posts

Posted - 06/12/2012 :  02:04:29 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi frefrafru,

Hideo mentioned that result for multiple t test may be not accurate for multiple members in a group to be compared. So you'd better use ANOVA. You can select Statistics: ANOVA: One-Way ANOVA from Origin's menu. And choose Tukey in Means Comparison branch. And Origin will show paiwise multiple mean comparison result in the report.

To determine each bar's label with letters, I think you can use recursive algorithm, e.g.
barlabel(const int n, const matrix <int> mSig, vector <string> &vLabel, ...)


-------------------------------------------

If n=1   vLabel={"a"};

If n>1
    run the recursive function for n-1, and get vLabel[i] from 0 to n-2
    if all the tests are no significant difference between barn and bari(i=1...n-1),
        then vLabel[n-1] will be the union of vLabel[i] (i=0...n-2)
    otherwise, vLabel[n-1] will be a new letter, and vLabel[i] (i=0...n-2) will be updated as follows: 
         if test of barn and bari is no significant difference, then vLabel[i] += vLabel[n-1]


Sam
OriginLab Technical Services
Go to Top of Page

n/a

Posts

Posted - 08/01/2013 :  08:18:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello everyone,

Hideo has always been useful in his suggestions (I am a silent reader here).
I do have the same task to do, but unfortunately I am not used to programming. Could you provide me the routine you mentioned in a clear script?

Thank you very much if so. But anyways!

Greetings,

David
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 08/02/2013 :  3:48:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi David,

Not sure how helpful this time, but the following is a crude procedure to make a column chart
with indications of pairs with significant differences from a Report Sheet of ANOVA1:

1. Prepare the data in a worksheet:
Put 1, 2, 3,... as Long Names in columns in the worksheet. (Sheet1 in sample)



2. Run 1-way ANOVA with Means Comparison option
(in Raw mode for input data). (ANOVA1Way1 created in sample.)

3. In the report sheet, press the fly-outs button at the Mean Comparison's Test branch,
and choose "Create Copy as New Sheet" fly-out. (Sheet3 created in sample.)



4. Also, press the fly-outs button at the Descriptive Statistics branch, and choose
"Create Copy as New Sheet" fly-out. (Sheet4 created in sample.)

5. Run the following script:
/////////////////////////////
wks$=%H;
//Select and extract significent pairs
addsheet book:=wks$ fname:=origin.otw active:=0;
layer -s 3;  //activate Mean Comparisons sheet
jj=0;
for(ii=1; ii<=wks.maxRows; ii++) {
  range sc=col(sig);  //Significance judgement
  if(sc[ii]==1) {  //select only significant pairs
    jj++;
    range aa=[wks$]3!col(1);
    %A=aa[ii]$;
    as1$=%[%A,#1];
    as2$=%[%A,#2];
    an1=%(as1$);
    an2=%(as2$);
    range bb1=[wks$]5!col(1);
    range bb2=[wks$]5!col(2);
    bb1[jj]=an1;
    bb2[jj]=an2;
  }
}
layer -s 4; //activate Ddescriptive Stats sheet
wks.col1.format=1; //change to Numeric from Text

window -a %(wks$);
layer -s 5; //pair list sheet
npairs=wks.maxRows;
layer -s 4; //activate Ddescriptive Stats sheet

//Create a column graph with SE as YErr
plotxy iy:=(1,4,6) plot:=203 ogl:=<new template:=column>;
gr$=%H;
for(ipair=1; ipair<=npairs; ipair++) {
  window -a %(wks$);
  layer -s 5;  //pair list sheet
  range bb1=[wks$]5!col(1);
  range bb2=[wks$]5!col(2);
  p1x$(ipair)=bb1[ipair];
  p2x$(ipair)=bb2[ipair];
  layer -s 5;  //pair list sheet
  range mm=[wks$]4!col(Mean);
  p1y$(ipair)=mm[p1x$(ipair)];
  p2y$(ipair)=mm[p2x$(ipair)];

  window -a %(gr$);
  if(p1y$(ipair)>=p2y$(ipair)) {
    draw -n p12$(ipair) -l {p1x$(ipair), p1y$(ipair), p2x$(ipair), p1y$(ipair)};
    p12$(ipair).vMove=1;
    label -s -a $((p1x$(ipair)+p2x$(ipair))/2) $(p1y$(ipair)) * $(p1x$(ipair))-$(p2x$(ipair));
  }
  else {
    draw -n p12$(ipair) -l {p1x$(ipair), p2y$(ipair), p2x$(ipair), p2y$(ipair)};
    p12$(ipair).vMove=1;
    label -s -a $((p1x$(ipair)+p2x$(ipair))/2) $(p2y$(ipair)) * $(p1x$(ipair))-$(p2x$(ipair));
    }
}
/////////////////////////////

6. Customize the final graph to make nicer.



Hope this gives some hints.

--Hideo Fujii
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 10/24/2013 :  4:38:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi All,

OriginLab has just released Origin 9.1, and it contains a new object-drawing tool, called
"Add Asterisk Bracket". Using this, you can draw an "asterisk bracket" to annotate and
compare two bars much easier than before.

             

--Hideo Fujii
OriginLab
Go to Top of Page

JoD

Germany
8 Posts

Posted - 02/01/2019 :  06:49:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello, is there an option for getting letters for significance obtained from ANOVA by now?
I'm using OriginPro 2018b and I oftern need to visualize the significance using small letters in graphs of tables.
Go to Top of Page

lkb0221

China
497 Posts

Posted - 02/01/2019 :  4:10:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by JoD

Hello, is there an option for getting letters for significance obtained from ANOVA by now?
I'm using OriginPro 2018b and I oftern need to visualize the significance using small letters in graphs of tables.



Please try the Paired Comparison Plot App



https://www.originlab.com/fileExchange/details.aspx?fid=390

This should work for your case.


Go to Top of Page

JoD

Germany
8 Posts

Posted - 02/04/2019 :  06:44:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by lkb0221

Please try the Paired Comparison Plot App



Thank you for the hint!

The plugin already helps, thank you! However, I couldn't figure out how to set the significance level. Also, it's unfortunate that it only works with indexed data mode. I think there should still be the option to get the small letters indicating significant differences directly in the Origin ANOVA report sheet.
Go to Top of Page

YimingChen

1606 Posts

Posted - 02/04/2019 :  3:01:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Thank you for pointing out that significance level needs to be adjusted. We'll improve the app to support that. We'll also discuss with our developers whether to support raw data input for this app and adding significance letters in ANOVA report sheet. Thank you.

James
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