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

Martin Maechler (maechler@stat.math.ethz.ch)
Tue, 14 Apr 1998 18:22:12 +0200


Date: Tue, 14 Apr 1998 18:22:12 +0200
Message-Id: <199804141622.SAA01845@sophie.ethz.ch>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: wsimpson@uwinnipeg.ca
Subject: Re: R-beta: SEs for one-param MLE in R?

>>>>> "Bill" == Bill Simpson <wsimpson@uwinnipeg.ca> 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!

Well,
 .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
     }}

Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._