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 for Programming
 LabTalk Forum
 Calculating Group/class mean
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AKazak

Russia
1205 Posts

Posted - 07/31/2020 :  06:53:26 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2020b (64-bit) 9.7.5.184
Windows 7 Pro x64 SP1

Greetings!

Please help me to find the reason for the wrong mean results in column D.
The formula in columns D behaves not as I expect (see below).

Thank you.




---
AK

YimingChen

1669 Posts

Posted - 07/31/2020 :  11:38:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You are missing $ sign, try below:

if(C==1,averageif(B,"A==A[i]$"))


James
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 07/31/2020 :  11:45:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

Hi,

You are missing $ sign, try below:

if(C==1,averageif(B,"A==A[i]$"))


James



Dear James,

Still getting weird results:




---
AK
Go to Top of Page

YimingChen

1669 Posts

Posted - 07/31/2020 :  12:45:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

averageif() seems not working properly within another function. We will look into it. Here is a workaround to get the same result.



James

Edited by - YimingChen on 07/31/2020 12:46:16 PM
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 08/01/2020 :  01:19:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

Hi,

averageif() seems not working properly within another function. We will look into it. Here is a workaround to get the same result.



James



Dear James,

OK, got it.
Please investigate the root cause of the issue and fix it.
These strange results almost broke my understanding of LT while I was trying to find out the reason for getting them.


---
AK
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 08/01/2020 :  2:43:46 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I can see the problem in 2020b but 2021 works fine.

I found there was a JIRA on this, ORG-22110, fixed date was June 17 2020, before beta1 of 2021.


Can you try your beta 2021?

CP
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 08/11/2020 :  5:42:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by cpyang

I can see the problem in 2020b but 2021 works fine.

I found there was a JIRA on this, ORG-22110, fixed date was June 17 2020, before beta1 of 2021.


Can you try your beta 2021?

CP




2021 Beta 3 works fine, but I don't understand the reason for "--" outputs below average values:



---
AK

Edited by - AKazak on 08/11/2020 5:42:49 PM
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 08/12/2020 :  2:03:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Another strange example:




---
AK
Go to Top of Page

Castiel

343 Posts

Posted - 08/12/2020 :  4:34:29 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by AKazak

quote:
Originally posted by cpyang

I can see the problem in 2020b but 2021 works fine.

I found there was a JIRA on this, ORG-22110, fixed date was June 17 2020, before beta1 of 2021.


Can you try your beta 2021?

CP




2021 Beta 3 works fine, but I don't understand the reason for "--" outputs below average values:



---
AK



The '--' is the numeric average of Col(B) when the coresponding row in Col(A) is an empty string: the numeric average of some 0/0 values.

IIRC, 0/0 in origin is -1.23456789e-300 (check the binary of NANUM in OriginC). In practice, this is not the NaN defined in IEEE 754.

When performing numeric operators, it need handling specifically. In the case of averageif, it first calculates of sum of 0/0 (remember, -1.23456789e-300): if handling specifically, should be 0/0, otherwise not 0/0. It then devides the summation with couting number: it could be 0/0 exactally or other values that can be treated as 0/0, for example -1.2345678901e-300.

For double-point floating values in computer, loss of precision happens so often when performing adding, substracting, multiplying, deviding etc.. In your cases, it shows '--' when the result can be treated as 0/0, or it shows some value close to it like -1.23457e-300.

Bug of averageif, of course, the average of 0/0 or -1.23456789e-300 values is not specifically handled to yield 0/0.


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------

Edited by - Castiel on 08/12/2020 4:40:23 PM
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 08/12/2020 :  6:24:45 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I still didn't get the logic of calculation.
Let's consider E4 cell in the last figure.

The formula firstly checks if cell B5 is empty, but it is not.
Is this case averageif function should return empty character, but not --.
Do I consider this correctly?


By the way, how do I tell averageif function to exclude cells that are empty or contain strings?

Thank you.


---
AK
Go to Top of Page

Castiel

343 Posts

Posted - 08/12/2020 :  7:08:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by AKazak

I still didn't get the logic of calculation.
Let's consider E4 cell in the last figure.

The formula firstly checks if cell B5 is empty, but it is not.
Is this case averageif function should return empty character, but not --.
Do I consider this correctly?


By the way, how do I tell averageif function to exclude cells that are empty or contain strings?

Thank you.


---
AK



I thought the order of evaluation of arguments is from right to left: first evaluate the averageif results, then check the condition.

I think I was wrong. Sorry for this confusion.


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------
Go to Top of Page

minimax

359 Posts

Posted - 08/13/2020 :  01:16:24 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Is this case averageif function should return empty character, but not --.


It is a bug, and it should have been fixed in latest internal build (> 2021 Beta3, ORG-22360-P1).
Go to Top of Page

AKazak

Russia
1205 Posts

Posted - 08/13/2020 :  05:33:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by minimax

quote:
Is this case averageif function should return empty character, but not --.


It is a bug, and it should have been fixed in latest internal build (> 2021 Beta3).



Great news!
I will be waiting for Beta 4 to check if it is fixed.


---
AK
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