# RE: st: finding a peak in an asymmetric curve

 From "David Harrison" To Subject RE: st: finding a peak in an asymmetric curve Date Tue, 11 Apr 2006 12:00:50 +0100

```In terms of the position of the peak, -pkexamine- will only tell you the
observed value of x that has the highest observed value of y.

If you know (or hypothesise) the underlying functional form of the data,
you could find a theoretical peak by using -nl- to fit a non-linear
model to the data, e.g.

. nl (y = x * exp(-(x - {c})/{r})), init(c 0 r 1) nolog
(obs = 68)

Source |       SS       df       MS
-------------+------------------------------         Number of obs =
68
Model |  5571019.21     2  2785509.61         R-squared     =
0.9992
Residual |  4437.80091    66  67.2394078         Adj R-squared =
0.9992
-------------+------------------------------         Root MSE      =
8.199964
Total |  5575457.01    68  81992.0149         Res. dev.     =
477.1073

------------------------------------------------------------------------
------
y |      Coef.   Std. Err.      t    P>|t|     [95% Conf.
Interval]
-------------+----------------------------------------------------------
------
/c |   .2423345   .0016988   142.65   0.000     .2389427
.2457263
/r |   .0226752   .0001888   120.13   0.000     .0222983
.023052
------------------------------------------------------------------------
------
* (SEs, P values, CIs, and correlations are asymptotic approximations)

If this functional form is correct, then the estimate for the peak is at
0.0227 (the value of the parameter r) and we also have a confidence
interval for it.

However, examining the results graphically shows that this functional
form is clearly wrong...

. twoway function y = x * exp(-(x - _b[c:_cons])/_b[r:_cons]), range(x)
///
|| scatter y x ///
, legend(off) xli(`=_b[r:_cons]')

If the points are as dense as in the example you gave, then just looking
at the point with the highest y value is a good bet. If you have bigger
gaps, you may want to think along these lines but remember that a
slightly wrong function could give you a totally wrong result.

Hope this helps

David

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.