looking for a way to use Excel LINEST( ) in c/c++?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KARTHIK RAJA
    New Member
    • Dec 2011
    • 1

    looking for a way to use Excel LINEST( ) in c/c++?

    I am looking for a way to use Excel LINEST, functions in C/C++. Do Microsoft or any third parties offer good tools to enable?? or where can i get the back end coding LINEST function.. to implement in my c program for my controller??

    Thank you.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2


    I am not an expert here but this link looks promising.

    Comment

    • Rabbit
      Recognized Expert MVP
      • Jan 2007
      • 12517

      #3
      So basically what you want is simple linear regression? There exists formulas to calculate regressions.
      Code:
      y = ax + b
      
      a = r * s(y) / s(x)
      b = average(y) - a * average(x)
      
      s(z) = square_root(1 / (N - 1) * sigma((z - average(z)) ^ 2))
      n = sample size
      
      r = sigma((x - average(x)) * (y - average(y))) / square_root(sigma(x - average(x)) ^ 2) / square_root(sigma(y - average(y)) ^ 2)
      That's the first level of formulas you will need. I don't think I need to go over how to calculate an average. r is pearson's coefficent and s is the standard deviation. Sigma is the mathematical symbol for summation where you calculate and add all values together.

      Comment

      Working...