Skip to content
Prev 78828 / 398502 Next

Sometimes having problems finding a minimum using optim(), optimize(), and nlm() (while searching for noncentral F parameters)

Ken Kelley <KKIII at Indiana.Edu> wrote
[SNIP]
Perhaps uniroot() might be better
 Low.Lim.NC.F <- function(Lambda, alpha.lower, F.value, df.1, df.2) {
    pf(q=F.value, df1=df.1, df2=df.2, ncp=Lambda) - (1-alpha.lower)
 }
 uniroot(Low.Lim.NC.F, interval=c(0,50000), alpha.lower=0.025, df.1=5,
 df.2=200, F.value=12)

If you plot your example, the gradients are much steeper from above than
below, so nlm() works when the starting value is say 50.  In addition,
underflow in pf for more extreme values of lambda affect these more
general search algorithms.


| David Duffy (MBBS PhD)                                         ,-_|\
| email: davidD at qimr.edu.au  ph: INT+61+7+3362-0217 fax: -0101  /     *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v