×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Curve Fitting A Gamma function

Curve Fitting A Gamma function

Curve Fitting A Gamma function

(OP)
Can Excel curve fit discrete data points which when plotted produce a rough gamma curve.  I am trying to get a smooth curve from my data points.

RE: Curve Fitting A Gamma function

Yes, but no.  The gamma function is not a built-in fit within Excel.

But, you should be able to fit the data by using the solver routine to adjust the gamma function coefficients to reduce the residual errors (differences between the fitted function and the data points).

You may want to look at using a Weibull function to fit the data also; although statisticall analysis with a Weibull function is a little more work, it can be useful for other reasons.

RE: Curve Fitting A Gamma function

You can get the Gamma function indirectly by using the natural log of Gamma--the natural log of the Gamma function is built-in within Excel. Here is a function returning the natural log of the Gamma function. There is also the WorksheetFunction GammaLn that can get you there.

Function gammaln2(xx As Double)
' Returns the natural log of the Gamma Function
' Is equivalent to Application.WorksheetFunction.GammaLn
    Dim ser As Double, stp As Double, tmp As Double, x As Double, y As Double
    Dim cof(6) As Double
    Dim j As Integer
    cof(1) = 76.1800917294715
    cof(2) = -86.5053203294168
    cof(3) = 24.0140982408309
    cof(4) = -1.23173957245015
    cof(5) = 1.20865097386618E-03
    cof(6) = -5.395239384953E-06
    stp = 2.506628274631
    x = xx
    y = x
    tmp = x + 5.5
    tmp = (x + 0.5) * Log(tmp) - tmp
    ser = 1.00000000019001
    For j = 1 To 6
    y = y + 1#
    ser = ser + cof(j) / y
    Next j
    gammaln2 = tmp + Log(stp * ser / x)
End Function

RE: Curve Fitting A Gamma function

(OP)
Prost,
My Gamma function is :I(t)=P*t^s*e^(-f*t)
The natural log is   :ln(t)=lnP+s*ln(t)-f*t
The linear equivalent:y= B(0)+ B(1)X(1)+B(2)X(2)

Now how do you propose the use your method with the above.
I should also mentioned that I did a regression for two independent variables which in my case would be X(1) and
X(2) and my result was 962*t^(4.12E-04)*e^(-8.52E-17).  When plotted this equation looked atrocious. I did not even bother doing an error computation.

RE: Curve Fitting A Gamma function

The Gamma function I know is an integral, so I have no idea what "P" is for you. My book shows:
Gamma(n)=integral(t^(n-1)*exp(-t)).

The only other forms for Gamma function I have found are asymptotic series expansions.

I don't understand what the question; I just checked the function--it returns ln(Gamma). Just use exponent "e" to convert to Gamma.

RE: Curve Fitting A Gamma function

Maybe this will help:
http://office.microsoft.com/en-us/excel/HP052042111033.aspx

search for "gamma" and they list GAMMADIST, GAMMAINV, AND GAMMALN

I think you can use these by typing in
 Application.WorksheetFunction.GAMMADIST(x,alpha,beta,cumulative)

same as the normal distribution functions NORMDIST, etc.

RE: Curve Fitting A Gamma function

A Gamma function is different from a Gamma distribution.

I think chicopee is needing a Gamma distribution, which apparently Excel can now provide

RE: Curve Fitting A Gamma function

(OP)
you are right zerosum

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources