Re: [R] Optimisation with Normalisation Constraint

2018-06-22 Thread Hans W Borchers
One way will be to solve this as an ordinary optimization problem with an equality constraint. Function `alabama::auglag` can do this: library(alabama) fn <- function(p) sum((df$y - p[1]*exp(-p[2]*df$x))^2) heq <- function(p) sum(p[1]*exp(-p[2]*df$x)) - 5 # Start with initial valu

Re: [R] Optimisation with Normalisation Constraint

2018-06-20 Thread David Winsemius
> On Jun 20, 2018, at 8:50 AM, Lorenzo Isella wrote: > > Dear All, > I have a problem I haver been struggling with for a while: I need to > carry out a non-linear fit (and this is the > easy part). > I have a set of discrete values {x1,x2...xN} and the corresponding > {y1, y2...yN}. The difficu

Re: [R] Optimisation with Normalisation Constraint

2018-06-20 Thread Jeff Newmiller
I recommend posting this on a mathematics discussion forum like Stack Exchange and (re-)reading the Posting Guide for this mailing list. I think you are going to need to re-write your model function to algebraically combine your original model along with the constraint, and then use the origina

[R] Optimisation with Normalisation Constraint

2018-06-20 Thread Lorenzo Isella
Dear All, I have a problem I haver been struggling with for a while: I need to carry out a non-linear fit (and this is the easy part). I have a set of discrete values {x1,x2...xN} and the corresponding {y1, y2...yN}. The difficulty is that I would like the linear fit to preserve the sum of the val

Re: [R] optimisation - Error in checkFunc(Func2, times, y, rho) : The number of derivatives returned by func() (22) must equal the length of the initial conditions vector (2)

2017-02-22 Thread Jim Lemon
I'm not really familiar with what you are doing. when I try to debug something like this, I run each step separately to determine where the error is. For example, if I clean up the code a bit and run the derivs function: derivs(time,y,parms) [[1]] [1] 429.709540 438.844035 281.741953 404.175

Re: [R] optimisation - Error in checkFunc(Func2, times, y, rho) : The number of derivatives returned by func() (22) must equal the length of the initial conditions vector (2)

2017-02-21 Thread Jim Lemon
Hi Malgorzata, Did you try to _install_ rather than just _load_ the XLConnect package? install.packages("XLConnect") Sad to say, your code: time=c(16,17,18,19,20,21,22,23,24,25,26) #x=c(20.2,18.9,16.5) y=c(7.63,9.22,4.86,4.78,0.38,6.13,3.91,38.41,2.58,36.95,1.73) cE=c(15.05,38.01,41.09,31.41,3.5

[R] optimisation - Error in checkFunc(Func2, times, y, rho) : The number of derivatives returned by func() (22) must equal the length of the initial conditions vector (2)

2017-02-21 Thread Malgorzata Wieteska via R-help
Hello, I get an error message:Error in checkFunc(Func2, times, y, rho) :   The number of derivatives returned by func() (22) must equal the length of the initial conditions vector (2) I try to optimise system of differential equations with 2 extra variables derived from the data.frame. I didn't

Re: [R] optimisation of the system of differential equations

2017-02-20 Thread Jim Lemon
Hi Malgorzata, There is currently another thread on the list about attaching R code to emails. The problem appears to be that if you attach a file with the extension ".R" it is sent in a way that is blocked by the mail server. If you want to attach an R code file to your message, change the extensi

Re: [R] optimisation of the system of differential equations

2017-02-20 Thread Jeff Newmiller
Go back and read the Posting Guide. 1) Missing code. Only certain types of attachments get through, and the recommendation is to include everything in the body of the email. Whatever you did, it did not get through to us. 2) Please make it clear what results you obtained and what results you

[R] optimisation of the system of differential equations

2017-02-20 Thread Malgorzata Wieteska via R-help
I try to do optimisation of the system of the differential equations. I've managed to make my exemplary code working, however after changing equations on the exact model and data on the real one, I get an error messages and code doesn't work. I have a partial data for L (concentrations were ass

Re: [R] Optimisation does not optimise!

2013-07-15 Thread Stephen Clark
f J C Nash (U30A) [mailto:nas...@uottawa.ca] Sent: 13 July 2013 13:07 To: r-help@r-project.org; Stephen Clark Subject: [R] Optimisation does not optimise! Considering that I devised the code initially on a computer with only 8K bytes for program and data, and it appears that your problem has 10

[R] Optimisation does not optimise!

2013-07-13 Thread Prof J C Nash (U30A)
AM, r-help-requ...@r-project.org wrote: Date: Fri, 12 Jul 2013 21:22:00 +0100 From: Stephen Clark To:"r-help@R-project.org" Subject: [R] Optimisation does not optimise! Message-ID: <928c4f7877280844b906d12d63a3f15b01145e5b5...@hermes8.ds.leeds.ac.uk> Content-Type: tex

[R] Optimisation does not optimise!

2013-07-12 Thread Stephen Clark
Hello, I have the following code and data. I am basically trying to select individuals in a sample (by setting some weights) to match known counts for a zone. This is been done by matching gender and age bands. I have tested the function to be optimised and it does behave as I would expect whe

Re: [R] Optimisation and NaN Errors using clm() and clmm()

2013-04-20 Thread Rune Haubo
On 18 April 2013 18:38, Thomas Foxley wrote: > Rune, > > Thank you very much for your response. > > I don't actually have the models that failed to converge from the first > (glmulti) part as they were not saved with the confidence set. glmulti > generates thousands of models so it seems reasonabl

Re: [R] Optimisation and NaN Errors using clm() and clmm()

2013-04-18 Thread Thomas Foxley
Rune, Thank you very much for your response. I don't actually have the models that failed to converge from the first (glmulti) part as they were not saved with the confidence set. glmulti generates thousands of models so it seems reasonable that a few of these may not converge. The clmm() m

Re: [R] Optimisation and NaN Errors using clm() and clmm()

2013-04-15 Thread Rune Haubo
On 15 April 2013 13:18, Thomas wrote: > > Dear List, > > I am using both the clm() and clmm() functions from the R package 'ordinal'. > > I am fitting an ordinal dependent variable with 5 categories to 9 continuous > predictors, all of which have been normalised (mean subtracted then divided > b

[R] Optimisation and NaN Errors using clm() and clmm()

2013-04-15 Thread Thomas
Dear List, I am using both the clm() and clmm() functions from the R package 'ordinal'. I am fitting an ordinal dependent variable with 5 categories to 9 continuous predictors, all of which have been normalised (mean subtracted then divided by standard deviation), using a probit link functi

Re: [R] Optimisation

2012-02-04 Thread Robbie Morrison
> Partha Sinha > Wed Feb 1 07:31:08 CET 2012 > > Can optimisation (simplex etc) be done through R? The GLPK mixed-integer library has R language bindings. I am not sure how up-to-date it is though. Information is available here: http://en.wikibooks.org/wiki/GLPK/R best wishes --- Robbie Mor

Re: [R] Optimisation

2012-02-01 Thread S Ellison
> Can optimisation (simplex etc) be done through R? > Try the CRAN task view on optimisation at, for example, 'http://finzi.psych.upenn.edu/views/Optimization.html *** This email and any attachments are confidential. Any use...{{

Re: [R] Optimisation

2012-02-01 Thread Steven Wolf
01, 2012 1:31 AM To: r-help Subject: [R] Optimisation Can optimisation (simplex etc) be done through R? __ R-help@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-guid

[R] Optimisation

2012-01-31 Thread Partha Sinha
Can optimisation (simplex etc) be done through R? __ R-help@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-containe

[R] optimisation, pseudo maximum likehood and family exponential in R

2010-04-21 Thread Eric
Hello, By fixing log_vraisemblance, gradient and hessian function linked to a family density like exp(theta.xi), I'm looking for some efficients estimators by PML. So I've seen optim,nlminb, et maxLik procedure. But I 'm not sure that the heteroscedacity of my estimators are considered. Does an

[R] Optimisation of xyplot style

2008-06-27 Thread Sébastien
Dear R-users, The following provides a basis to illustrate some questions I have about xyplot() customization. x <- rep(1:2, times = 6) y <- numeric() for (i in 1:3) { y <- c(y, 1:4*10^(i-1)) } g <- rep(1:6, each = 2) ax <- rep(1:3, each = 4) tmp <- data.frame(x,y,g) xyplot(y ~ x | g, a