[R] question about nlminb

From: John Pitchard <johnpitchard_at_googlemail.com>
Date: Tue, 08 Apr 2008 10:15:41 +0100


 Dear All,

I wanted to post some more details about the query I sent to s-news last week.

I have a vector with a constraint. The constraint is that the sum of the vector must add up to 1 - but not necessarily positive, i.e.

x[n] <- 1 -(x[1] + ...+x[n-1])

I perform the optimisation on the vector x such that

x <- c(x, 1-sum(x))

In other words,

fn <- function(x){
  x <- c(x, 1 - sum(x))
  # other calculations here
}

then feed this into nlminb()

out <- nlminb(x, fn)

out.x <- out$parameters
out.x <- c(out.x, 1 - sum(out.x))
out.x

I would like to calculate standard errors for each of the components of x. Is this possible by outputing the Hessian matrix? Furthermore, how would I calculate this for the last component (if this is indeed possible) which has the restriction (i.e. 1-sum(out.x))?

Any help would be much appreciated.

Regards,
John

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 08 Apr 2008 - 10:17:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Apr 2008 - 10:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive