Dear All, I am using optim() to minimise a function, (y-E exp{a*(2-(L+E/K))+ a * c (L/E -1))^2 I would like the result to respect the following constraints. The problem I am having problems understanding is how to impose them, when they relate not to the parameters a and c directly, but to equations containing a and c, alpha = a * (L+E/K) beta = a * (c * L/E + L/K) gamma = 1 - alpha - beta where alpha, beta and gamma are all non-negative and sum to 1. Gamma itself does not appear in the function to be fitted. I note that within Mathematic it is possible to solve under constraints on the parameters and equations containing the parameters ? Is this possible in R ? Does anyone have any ideas ? Am I missing an obvious mathematical solution and thereby asking too much of r ? many thanks Ben Warr -------------- next part -------------- An HTML attachment was scrubbed... URL: https://stat.ethz.ch/pipermail/r-help/attachments/20010717/39f8a427/attachment.html
Equation constraints: optim()Dear R-users, is it possible to exract from a data frame the rows whose name contains a certain letter? Thank you, Luca -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Mon, 24 Sep 2001, luca laghi wrote:> Equation constraints: optim()Dear R-users, > is it possible to exract from a data frame the rows whose name contains a > certain letter? > Thank you, LucaIs this what you want? library(MASS) data(hills) hills[grep("r", row.names(hills)), ] which gives the rows whose row names contain "r". -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._