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
 Cumulative Normal Distribution

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
deanwilk Posted - 10/18/2004 : 12:20:28 AM
Origin Version (Select Help-->About Origin): 7.5
Operating System: Windows 2000

I am trying to fit data to a cumulative normal distribution (or cumulative lognormal distribution). I don't see the cumulative distribution listed in the funtions. Is there a simple way to add this distribution to the functions Origin is capable of fitting?

My next challenge is to take the difference between the cumulative distribution for two neighboring values, e.g., cumnormaldist(x,mean,sigma)-cumnormaldist(x-1,mean,sigma). I then want to fit this difference of the normal distribution to some data I have on hand. Can you suggest a simple way to program the difference of the cumulative distribution into Origin so I can use this as the fitting function?

Thanks for your help!
3   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 12/18/2006 : 07:04:48 AM
Add this below #include <Origin.h> at the top of _nlfuser2.fit...

double norm_cdf(double x, double mu = 0, double sigma = 1);

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 12/18/2006 07:15:10 AM
mruehrig Posted - 12/17/2006 : 8:08:03 PM
quote:

Hi,

The cumulative normal distribution function is available in the NAG library under the function named nag_cumul_normal(x). You can call this function from your custom fitting function in NLSF. Note that to call the NAG function in your NLSF fitting function, you should first edit your fitting function in code builder (click the Edit in Code Builder button in the NLSF tool), and then replace all the #include statements at the top of the function with just one statement:
#include <origin.h>

Now, the nag_cumul_normal() function assumes a mu (centroid) of zero and sigma (std dev) of 1. So if you want something more general, I suggest that you define a new Origin C function as follows:

1> Go to code builder and start a new C file - give it a name say for example MyFunctions.c
2> Add the following function to that file and compile

double norm_cdf(double x, double mu = 0, double sigma = 1)
{
if( sigma > 0 )
return nag_cumul_normal( ( x - mu ) / sigma );
else
return NANUM;
}


3> Now your new function norm_cdf() will allow computing the cumulative distribution for a specified mu and sigma
4> In Code Builder, drag-and-drop the file from the User folder to the System folder. Then this function will be available any time you launch Origin
5> Then, in NLSF, you can refer to this function in your custom fitting function code using the syntax
norm_cdf(x, mu, sigma). Note that mu and sigma default to 0 and 1 respectively if not specified.

Easwar
OriginLab






Tried this but it does not work. I generated the folowin plot of a log normal distribution and tried to fit it wit a user defined function "user2"
y = norm_cdf(x, mu, sigma),
but fittig does not start, even.

When compiling in the Code builder of NLSF I get the following error messages:

C:\Programme\OriginLab\OriginPro75\Manni\OriginC\NLSF\_nlfuser2.fit(37) :Error, function or variable norm_cdf not found
C:\Programme\OriginLab\OriginPro75\Manni\OriginC\NLSF\_nlfuser2.fit(37) :Error, general compile error
C:\Programme\OriginLab\OriginPro75\Manni\OriginC\NLSF\_nlfuser2.fit(28) :Error, error(s) found in compiling function _nlsfuser2

easwar Posted - 10/18/2004 : 4:33:54 PM
Hi,

The cumulative normal distribution function is available in the NAG library under the function named nag_cumul_normal(x). You can call this function from your custom fitting function in NLSF. Note that to call the NAG function in your NLSF fitting function, you should first edit your fitting function in code builder (click the Edit in Code Builder button in the NLSF tool), and then replace all the #include statements at the top of the function with just one statement:
#include <origin.h>

Now, the nag_cumul_normal() function assumes a mu (centroid) of zero and sigma (std dev) of 1. So if you want something more general, I suggest that you define a new Origin C function as follows:

1> Go to code builder and start a new C file - give it a name say for example MyFunctions.c
2> Add the following function to that file and compile

double norm_cdf(double x, double mu = 0, double sigma = 1)
{
if( sigma > 0 )
return nag_cumul_normal( ( x - mu ) / sigma );
else
return NANUM;
}


3> Now your new function norm_cdf() will allow computing the cumulative distribution for a specified mu and sigma
4> In Code Builder, drag-and-drop the file from the User folder to the System folder. Then this function will be available any time you launch Origin
5> Then, in NLSF, you can refer to this function in your custom fitting function code using the syntax
norm_cdf(x, mu, sigma). Note that mu and sigma default to 0 and 1 respectively if not specified.

Easwar
OriginLab




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