Re: R-beta: SEs for one-param MLE in R?

Martin Maechler (
Tue, 14 Apr 1998 18:22:12 +0200

Date: Tue, 14 Apr 1998 18:22:12 +0200
Message-Id: <>
From: Martin Maechler <>
Subject: Re: R-beta: SEs for one-param MLE in R?

>>>>> "Bill" == Bill Simpson <> writes:

    Bill> Simple-mindedly I tried getting MLE and SE for one-parameter
    Bill> model in the same way as for multi-param models.

    Bill> out<-nlm(fn,p=c(2),hessian=T)

    Bill> But sqrt(diag(solve(out$hessian))) gives the answer 1.  The
    Bill> Hessian has only one entry, not really a matrix.  diag(x) gives 1
    Bill> if x is just a single number.

    Bill> Is this what I should be doing to get SE for MLE?
    Bill> sqrt(solve(out$hessian))

    Bill> Thanks very much for any help!

 .Internal(nlm(..)) should be fixed to always return a matrix in  $ hessian.

However, your problem is solved easily by always using

	p <- length(estimate)
	SE <- sqrt(if(p==1) 1/out$hessian else diag(solve(out$hessian)))

BTW: I am (we are) interested in the functions that you are writing for nlm(.)
     It certainly is worthwhile to have nlm(.) return a class "nlm" result
     and provide  print.nlm(.) and summary.nlm(.) functions
     {{ Jim Lindsey already posted something like this, unfortunately using
	"nls" which we don't want as long as it is not very close to S'
	nls(.) function

r-help mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: