Re: [R] R optim() function

2020-10-29 Thread J C Nash
The issue is almost certainly in the objective function i.e., diagH, since Nelder Mead doesn't use any matrix operations such as Choleski. I think you probably need to adjust the objective function to catch singularities (non-positive definite cases). I do notice that you have two identical parame

[R] R optim() function

2020-10-29 Thread Baker, Kieran via R-help
Hi R-Help, I am using R to do functional outlier detection (using PCA to reduce to 2 dimensions - the functional boxplot methodology used in the Rainbow package), and using Hscv.diag function to calculate the bandwidth matrix where this line of code is run: result <- optim(diag(Hstart), scv.mat

Re: [R] optim function

2018-07-14 Thread J C Nash
Subject: Re: [R] optim function Date: Fri, 13 Jul 2018 17:06:56 -0400 From: J C Nash To: Federico Becerra Though I wrote the original codes for 3 of the 5 solvers in optim(), I now suggest using more recent ones, some of which I have packaged. optimx on R-forge (not the one on CRAN yet) has

Re: [R] optim function

2018-07-13 Thread MacQueen, Don via R-help
There's a CRAN Task View on optimization. There might be something useful there. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 Lab cell 925-724-7509 On 7/13/18, 11:43 AM, "R-help on behalf of Federico Becerra" wrote:

[R] optim function

2018-07-13 Thread Federico Becerra
Good afternoon, I am a Biology researcher working on Functional Morphology and Behaviour in mammals. Nowadays, I have a series of morphological data that I would like to test against different models for which I would need to optimize them -namely, "randomly manipulating" all models parameters

Re: [R] Optim function returning always initial value for parameter to be optimized

2018-02-10 Thread Paul Gilbert
On 02/10/2018 06:00 AM, r-help-requ...@r-project.org wrote: Did you check the gradient? I don't think so. It's zero, so of course you end up where you start. Try data.input= data.frame(state1 = (1:500), state2 = (201:700) ) err.th.scalar <- function(threshold, data){ state1 <- data$stat

Re: [R] Optim function returning always initial value for parameter to be optimized

2018-02-09 Thread ProfJCNash
Did you check the gradient? I don't think so. It's zero, so of course you end up where you start. Try data.input= data.frame(state1 = (1:500), state2 = (201:700) ) err.th.scalar <- function(threshold, data){ state1 <- data$state1 state2 <- data$state2 op1l <- length(state1) op2l

[R] Optim function returning always initial value for parameter to be optimized

2018-02-09 Thread BARLAS Marios 247554
Hello, I'm trying to fminimize the following problem: You have a data frame with 2 columns. data.input= data.frame(state1 = (1:500), state2 = (201:700) ) with data that partially overlap in terms of values. I want to minimize the assessment error of each state by using this function: err.th.

[R] Optim function collectively for all Rows in a dataframe

2014-08-05 Thread Sumit Khanna
Hello, In the following code, I need to calculate parameters par_1,par_2,par_3,seperately for all the rows in casted data-frame . how may I avoid the for loop because it is taking too much time , as in I want to calculate optimized parameters(initial values 0.2,0.25,0.3 ,,, so that I get paramet

Re: [R] Optim function & Hessian matrix

2013-11-19 Thread David Winsemius
This is the code that was attached. I arrived in the copy sent to my email address: #-- L1=function(X){ B1=X[1] C1=X[2] B2=X[3] C2=X[4] mu=X[5] S=-(B1*(C1^x)*((C1^v)-1)/log(C1)) +(d2*log(B1*(C1^(x+v -(B2*(C2^y)*((C2^v)-1)/log(C2)) +(d1*log(B2*(C2^(y+v -(v*mu) +

Re: [R] Optim function & Hessian matrix

2013-11-19 Thread David Winsemius
On Nov 19, 2013, at 12:09 PM, sofeira taajobian wrote: > Dear R Users > Hi, > > > I have very emergency problems in my programming about finding MLE > with optim command. I reproduced it with real data. I guess that my > function object in optim is very sensitive because it has power > func

Re: [R] Optim function with multivariate inputs

2011-08-28 Thread Uwe Ligges
On 25.08.2011 19:02, Noah Silverman wrote: Hi, I have function that I want to optimize. Am playing with the optim() function in R Two issues: 1) I can't seem to get it to work with a function that takes multiple inputs. Dummy Example: myFunc<- function(A,B,D,D){ A really dummy exampl

[R] Optim function with multivariate inputs

2011-08-25 Thread Noah Silverman
Hi, I have function that I want to optimize. Am playing with the optim() function in R Two issues: 1) I can't seem to get it to work with a function that takes multiple inputs. Dummy Example: myFunc <- function(A,B,D,D){ # Do stuff return E } > myFunc(1,2,3,4) [1] 12 # wor

Re: [R] optim function multi variables -newbie

2011-01-28 Thread Hans W Borchers
michalseneca gmail.com> writes: > I tried to modify the code,thanks for noticing... > now i get that the function cannot be evaluated at initial parameters. > However I do not know what does that mean.. > Should I try to modify parameters. I am still not sure of syntax of > function. I cannot get

Re: [R] optim function multi variables -newbie

2011-01-28 Thread michalseneca
I tried to modify the code,thanks for noticing...now i get that the function cannot be evaluated at initial parameters.However I do not know what does that mean..Should I try to modify parameters. I am still not sure of syntax of function. I cannot get that optimize work correctly. I am trying to

Re: [R] optim function multi variables -newbie

2011-01-27 Thread Hans W Borchers
michalseneca gmail.com> writes: > Hi, > Basically what I am trying is to rewrite matlab code into R ...This is code > for famous SABR model Calibration. > I did most of the code up to optimalization issue. > In the attachment you can find matlab and my unfinished R code..This is very > helpful co

Re: [R] optim function multi variables -newbie

2011-01-27 Thread michalseneca
Hi, Basically what I am trying is to rewrite matlab code into R ...This is code for famous SABR model Calibration. I did most of the code up to optimalization issue. In the attachment you can find matlab and my unfinished R code..This is very helpful code...Basically I am trying to achieve the sam

Re: [R] optim function multi variables -newbie

2011-01-27 Thread Uwe Ligges
On 27.01.2011 14:08, michalseneca wrote: Hi , can i ask if somebody know the syntax for optim function with multiple variables: I have function f (params,y,g,h,j) returnig z y<-C(0.2,0.5,0.6) where params<-c(x1,x2) I define g,h,j and then I define params, then use optim to structure it ..ho

[R] optim function multi variables -newbie

2011-01-27 Thread michalseneca
Hi , can i ask if somebody know the syntax for optim function with multiple variables: I have function f (params,y,g,h,j) returnig z y<-C(0.2,0.5,0.6) where params<-c(x1,x2) I define g,h,j and then I define params, then use optim to structure it ..however if i use syntax optim(params , f,y=y,

[R] optim function with meta parameters

2010-12-17 Thread Alberto Casetta
Hi. I have a dataset with 4 columns. In the first and second column I have the same qualitative variable referred to different teams of people. There are 10 teams in total and they compete against each other to perform a certain task whose result is stored in the third column for the team reco

[R] Optim function with meta parameters

2010-12-16 Thread albechan
Hi guys. I have a dataset with 4 columns. In the first and second column I have the same qualitative variable referred to different teams of people. There are 10 teams in total and they compete against each other to perform a certain task whose result is stored in the third column for the team rec

Re: [R] Optim function in the loop

2009-05-05 Thread Uwe Ligges
Hard to say without seeing Linn() and maybe other relevant data. Uwe Ligges Rstarer wrote: Thanks for the reply. optim(initpar,Linn,NULL,method="BFGS",hessian=TRUE,control=list(trace=1,REPORT=1,maxit=300)) The optim is to minimize the negative likelihood function which is performed in funct

Re: [R] Optim function in the loop

2009-05-04 Thread Rstarer
Thanks for the reply. optim(initpar,Linn,NULL,method="BFGS",hessian=TRUE,control=list(trace=1,REPORT=1,maxit=300)) The optim is to minimize the negative likelihood function which is performed in function "Linn", Every time the code stops right after optim, for example, the output looks like: "

Re: [R] Optim function in the loop

2009-05-03 Thread Ravi Varadhan
sor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Rstarer Date: Sunday, May 3, 2009 5:01 am Subject: [R] Optim function in the loop To: r-help@r-project.org > Hi a

[R] Optim function in the loop

2009-05-03 Thread Rstarer
Hi all, I wrote the following lines of codes try to do some iterations to find the global optimal values, but the function does not execute properly. Every time codes stop after one iteration right after executing the optim() function. Does anyone could have me to take a look? Thanks. if (count>0