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
 All Forums
 Origin Forum
 Origin Forum
 Error Bars

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
krasopater Posted - 03/01/2004 : 07:06:34 AM
Hi.
I have a problem with error bars.
This problem has been posted but I did not found any solution to my problem.

I have a list of X, Y values in two columns like the following list:

X Y
1 12
1 12
1 13
1 15
2 21
2 23
2 24
2 21
3 33
3 35
3 34
4 21
4 22
4 23

How can I create a 2D X,Y plot graph showing at the same time the standard diviation of each X value (error bars Y) directly from these data????????!!!!!!!!!!!!!!!!!!!
I think Origin can not calculate the SD of each X value simply with this type of Data. However, other software, like Sigmaplot 8.02 can do it in a few clicks.

Thanks
3   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 03/01/2004 : 5:02:41 PM
This uses the ExtractOneGroup OriginC function discussed by CP in the topic referenced above. (Origin 7.5 SR1)
void sum_all_groups(int nGroupCol = 0, int nDataCol = 1)
{
Worksheet wks = Project.ActiveLayer();
Dataset dGroup(wks, nGroupCol);
vector<ushort> vRowMap;
vRowMap = dGroup;
Worksheet wResult;
wResult.Create();
wResult.AddCol();
wResult.AddCol();
wResult.Columns(1).SetName("Mean");
wResult.Columns(2).SetName("SD");
wResult.Columns(3).SetName("N");
wResult.Columns(2).SetType(OKDATAOBJ_DESIGNATION_ERROR);
BasicStats bsStat;
Data_sum(&dGroup,&bsStat);
int iMin = bsStat.min;
int iMax = bsStat.max;
int nGroup;
for(int i=iMin;i<=iMax;i++)
{
if( sum_one_group(wks, bsStat, vRowMap, i, nDataCol) )
{
wResult.SetCell(nGroup,0,i);
wResult.SetCell(nGroup,1,bsStat.mean);
wResult.SetCell(nGroup,2,bsStat.sd);
wResult.SetCell(nGroup,3,bsStat.N);
nGroup++;
}
}
}

int sum_one_group(Worksheet wks, BasicStats &bsStat, vector<ushort> vRowMap, int nGroupVal, int nDataCol)
{
vector vResult;
if( wks.ExtractOneGroup(vResult, nDataCol, vRowMap, 0, 0, vRowMap.GetSize()-1, nGroupVal) )
{
Dataset dOut;
dOut.Create(vResult.GetSize());
dOut = vResult;
Data_sum(&dOut,&bsStat);
return bsStat.N;
}
return 0;
}


Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 03/02/2004 3:11:15 PM
krasopater Posted - 03/01/2004 : 11:11:07 AM
Thanks.

I am not familiar with the listing thing, but I will take a look.
peter.cook Posted - 03/01/2004 : 10:51:42 AM
Hi,

Yes...I agree this would a nice standard feature for Origin!

You might want to look at
http://www.originlab.com/forum/topic.asp?TOPIC_ID=2924
for Origin C or consider someting like :

// %1 : input x dataset
// %2 : input y dataset
// %3 : output x dataset
// %4 : output mean y dataset
// %5 : output sd dataset

def GenMeanSEXY {
MeanYZero=0/0;
MeanYTop=0/0;
MeanYBot=0/0;
sum(%1);
Numpoints=sum.n;
MaxXValue=sum.max;
sum(%2);
MaxYValue=sum.max;
MinYValue=sum.min;
NumdiffX=1; XStart1=1; XFinish1=1; %3[1]=%1[1];
loop(NumXValue,2,NumPoints) {
If(%1[NumXValue]>%1[XFinish$(NumDiffX)]) {
NumDiffX=NumDiffX+1;
XStart$(NumDiffX)=NumXValue;
%3[NumDiffX]=%1[NumXValue];
};
XFinish$(NumDiffX)=NumXValue;
};
loop(NumXValue,1,NumDiffX) {
NumYValues=XFinish$(NumXValue)-XStart$(NumXValue)+1;
Create TempY -n NumYValues;
Copy -b XStart$(NumXValue) %2 TempY -b 1 -e NumYValues;
Sum(TempY);
delete -s TempY;
%4[NumXValue]=sum.mean;
%5[NumXValue]=sum.sd;
};
MeanYTop=%4[NumDiffX];
If(%3[1]==0) {
MeanYZero=%4[1];
MeanYBot=%4[2];
MinXValue=%3[2];
} else {
MeanYBot=%4[1];
MinXValue=%3[1];
};
};



Cheers,

Pete


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000