[R] optimizing with non-linear constraints

Rainer M Krug Rainer at krugs.de
Thu Oct 1 09:37:11 CEST 2015


Ravi Varadhan <ravi.varadhan at jhu.edu> writes:

> Hi Rainer,
> It is very simple to specify the constraints (linear or nonlinear) in
> "alabama" .  They are specified in a function called `hin', where the
> constraints are written such that they are positive.

OK - I somehow missed the part that, when the values x are valid, i.e. in
the range as defined by the conditions, the result of hin(x) that they
are all positive.

> Your two nonlinear constraints would be written as follows:
>
> hin <- function(x, LAI) {
> h <- rep(NA, 2)
> h[1] <- LAI^x[2] / x[3] + x[1]
> h[2] <- 1 - x[1] - LAI^x[2] / x[3]
> h
> }

Makes perfect sense.

>
> Please take a look at the help page.  If it is still not clear, you can contact me offline.

Yup - I did. But I somehow missed the fact stated above.

I am using constrOptim() and constrOptim.nl() for a paper
and am compiling a separate document which explains how to get the
constraints for the two functions step by step - I will make it
available as a blog post and a pdf.

I might have further questions concerning the different fitting
functions and which ones are the most appropriate in my case.

Thanks a lot,

Rainer


> Best,
> Ravi
>
> Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg)
> Associate Professor,  Department of Oncology
> Division of Biostatistics & Bionformatics
> Sidney Kimmel Comprehensive Cancer Center
> Johns Hopkins University
> 550 N. Broadway, Suite 1111-E
> Baltimore, MD 21205
> 410-502-2619
>
>
> 	[[alternative HTML version deleted]]
>

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 454 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20151001/aba6f3ad/attachment.bin>


More information about the R-help mailing list