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

Martin Maechler maechler at stat.math.ethz.ch
Tue Apr 14 18:22:12 CEST 1998

>>>>> "Bill" == Bill Simpson <wsimpson at 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!

 .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 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 at stat.math.ethz.ch

More information about the R-help mailing list