[R] (on) first value from nlm (non-finit value supplied by nlm)

Thomas Bock Thomas.Bock at ptb.de
Mon Oct 27 11:36:46 CET 2003


Dear R-helpers,

if someone is interested in (last night I dreamed):
  ...
SH <- -3.8
fn.2 <- function(p){
    for (i1 in ilong){
      ex[i1] <- (1E-19*p[1]*n*L*voigt(u,v,f[i1],foN,p[2],p[3])[[1]])
    }
 sum((log(tt)-ex)^2)
}
out.2 <-nlm(fn.2, p = c(SH,GG,GL), hessian = TRUE,
           steptol = 1e-6, iterlim = 1000,print.level=2)
SN <-  out.2$estimate[1]*(1E-19)
GGN <- out.2$estimate[2]
GLN <-  out.2$estimate[3]
...
which works:
  ...

iteration = 10
Parameter:
[1] -3.800003499  0.005181922  0.006242639
Function Value
[1] 1.068854
Gradient:
[1] -0.01561930  0.02665086 -0.01232618

Successive iterates within tolerance.
Current iterate is probably solution.
...

Another thing: 
Since I receive the R-help digest
I have this in my ~/.emacs:
 (custom-set-faces
'(font-lock-string-face ((t (:foreground "green3"))))
'(font-lock-keyword-face ((t (:foreground "#f939ff"))))
)
(defun highlight-R-help ()
  (interactive)
  (highlight-regexp "Message:" 'font-lock-keyword-face)
  (highlight-regexp "Date:" 'font-lock-string-face)
  (highlight-regexp "Subject:" 'font-lock-string-face)
  (highlight-regexp "From:" 'font-lock-string-face))

(defun unhighlight-R-help ()
  (interactive)
  (unhighlight-regexp  "Message:" )
  (unhighlight-regexp  "Date:" )
  (unhighlight-regexp  "Subject:")
  (unhighlight-regexp  "From:"))
;;;

regards
Thomas




More information about the R-help mailing list