Statistical Functions in C#
-
I would like to know if there is any built in function/library in C# which lets me solve the foll. Statistical problem: Given the mean and the variance of a normal distribution, I want to get the sample points that are arrived at based on the mean and variance. (Basically some function similar to the Worksheet function NormInv in MSExcel). Right now I am doing a very kludgy solution where I create an Excel Worksheet function object just to access the function. This makes my application real slow. :( Moreover I need this type of evaluation to be done possibly 10,000 times as I am developing some kind of a simulator. Anybody please help !!!!
-
I would like to know if there is any built in function/library in C# which lets me solve the foll. Statistical problem: Given the mean and the variance of a normal distribution, I want to get the sample points that are arrived at based on the mean and variance. (Basically some function similar to the Worksheet function NormInv in MSExcel). Right now I am doing a very kludgy solution where I create an Excel Worksheet function object just to access the function. This makes my application real slow. :( Moreover I need this type of evaluation to be done possibly 10,000 times as I am developing some kind of a simulator. Anybody please help !!!!
-
I would like to know if there is any built in function/library in C# which lets me solve the foll. Statistical problem: Given the mean and the variance of a normal distribution, I want to get the sample points that are arrived at based on the mean and variance. (Basically some function similar to the Worksheet function NormInv in MSExcel). Right now I am doing a very kludgy solution where I create an Excel Worksheet function object just to access the function. This makes my application real slow. :( Moreover I need this type of evaluation to be done possibly 10,000 times as I am developing some kind of a simulator. Anybody please help !!!!
I'm sure I remember there being a C# math library on the web somewhere - probably not free though and I can't remember what it was called or whether it supported stats. Ah, just did a search and there's one here: http://www.centerspace.net/products.php?page=3[^] The stats library is released next month. Kevin
-
I would like to know if there is any built in function/library in C# which lets me solve the foll. Statistical problem: Given the mean and the variance of a normal distribution, I want to get the sample points that are arrived at based on the mean and variance. (Basically some function similar to the Worksheet function NormInv in MSExcel). Right now I am doing a very kludgy solution where I create an Excel Worksheet function object just to access the function. This makes my application real slow. :( Moreover I need this type of evaluation to be done possibly 10,000 times as I am developing some kind of a simulator. Anybody please help !!!!
-
I would like to know if there is any built in function/library in C# which lets me solve the foll. Statistical problem: Given the mean and the variance of a normal distribution, I want to get the sample points that are arrived at based on the mean and variance. (Basically some function similar to the Worksheet function NormInv in MSExcel). Right now I am doing a very kludgy solution where I create an Excel Worksheet function object just to access the function. This makes my application real slow. :( Moreover I need this type of evaluation to be done possibly 10,000 times as I am developing some kind of a simulator. Anybody please help !!!!
I'm not sure exactly what you are after, but this may help?
using System; namespace NormInvFunc{ public class Normal { private static double Density(double x) { double y=Math.Pow (2*Math.PI ,-.5)*Math.Exp(-.5*x*x); return y; } public static double StandardNormal(double x) { double [] a=new double[5]; a[0]=.31938153; a[1]=-.356563782; a[2]=1.781477937; a[3]=-1.821255978; a[4]=1.330274429; double K=.2316419; double L=Math.Abs(x); double nx=Density(L); double q=1/(1+K*L); double S=0; for(int j=0;j<5;j++) { S+= a[j]*Math.Pow(q,j+1); } double SND=1-nx*S; if(x<0) { SND=1-SND; } return SND; } public static double StandardNormalInv(double R) { double Delta=1; double X=0; double Y=0; do { Y=X-(StandardNormal(X)-R)/Density(X); Delta=Math.Abs (Y-X); X=Y; } while (Delta>.000000001); return Y; } } }
NB will not return quite as many decimal places as excel.