Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers LCC > implementations...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 991 of 1062
Post > Topic >>

implementations of kurtosis

by John Smith <JSmith@[EMAIL PROTECTED] > Oct 13, 2007 at 03:19 PM

/* Return the kurtosis of values in datalist.
    kurtosis1 implements the formula used by
    MINITAB and MS Excel. */
double kurtosis1(double *datalist, size_t listsize)
{
     int idx;
     double n, mean, sd, t1, t2, t3;

     n = (double)listsize;
     mean = a_mean(datalist, listsize);
     sd = s_stdev(datalist, listsize);
     if(n < 4. || dbl_isequal(sd, 0.0))
     {
         fprintf(stderr, "\nerror: invalid input to kurtosis()\n");
         return 0.0;
     }
     t1 = (n*(n+1))/((n-1)*(n-2)*(n-3));
     t2 = 0.0;
     for(idx = 0; idx < listsize; idx++)
     {
         t2 += pow((datalist[idx] - mean)/sd, 4.);
     }
     t3 = (3.0*((n-1)*(n-1)))/((n-2)*(n-3));

     return (t1 * t2) - t3;
}

/* Return the kurtosis of values in datalist.
    kurtosis2 implements the formula used by NIST Dataplot. */
double kurtosis2(double *datalist, size_t listsize)
{
     int idx;
     double mean, sd, sum;

     mean = a_mean(datalist, listsize);
     sd = s_stdev(datalist, listsize);
     sum = 0.0;
     for(idx = 0; idx < listsize; idx++)
     {
         sum += pow(datalist[idx] - mean, 4.0) / (listsize - 1);
     }

     return sum / pow(sd, 4.0);
}
 




 1 Posts in Topic:
implementations of kurtosis
John Smith <JSmith@[EM  2007-10-13 15:19:58 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 14:35:43 CDT 2008.