[R] nlminb() - how do I constrain the parameter vector properly?
wdunlap at tibco.com
Mon Oct 21 03:41:44 CEST 2013
Do you mean that your objective function (given to nlminb) parameterized
a positive definite matrix, P, as the elements in its upper (or lower) triangle?
If so, you could reparameterize it by the non-zero (upper triangular) elements
of the Choleski decomposition, C, of P. Compute P as crossprod(C), compute
the initial estimate of C as chol(P).
Spotfire, TIBCO Software
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf
> Of Steven LeBlanc
> Sent: Sunday, October 20, 2013 3:02 PM
> To: r-help at R-project.org
> Subject: [R] nlminb() - how do I constrain the parameter vector properly?
> I'm trying to use nlminb() to estimate the parameters of a bivariate normal sample and
> during one of the iterations it passes a parameter vector to the likelihood function
> resulting in an invalid covariance matrix that causes dmvnorm() to throw an error. Thus,
> it seems I need to somehow communicate to nlminb() that the final three parameters in
> my parameter vector are used to construct a positive semi-definite matrix, but I can't see
> how to achieve this using the constraint mechanism provided. Additional details are
> provided in the code below.
> Best Regards,
> Generate the data set I'm using:
> complete<-sample.deleted[!(is.na(sample.deleted[,1]) | is.na(sample.deleted[,2])),]
> Try to estimate the parameters of the data set less the deleted values:
> Escape and it stops at Iteration 9 on my machine.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help