Re: [R] Error in optim with method L-BFGS-B when hessian is TRUE

2020-08-23 Thread Marc Girondot via R-help
Sorry... it is already stated in the help, at the hessian section: hessian Only if argument hessian is true. A symmetric matrix giving an estimate of the Hessian at the solution found. Note that this is the Hessian of the unconstrained problem even if the box constraints are active. So no pro

[R] Error in optim with method L-BFGS-B when hessian is TRUE

2020-08-23 Thread Marc Girondot via R-help
Dear members, I fought for several days against an error I was getting with optim in L-BFGS-B. The error was produced because some parameters were outside the limits defined by upper and lower. After investigation, the error is not produced during the optimization itself but during the calcula

[R] error in optim: initial value in 'vmmin' is not finite

2012-02-23 Thread garciap
Dear r-helpers, I'm experiencing some problems in fitting a maximum likelihood binomial model to some of my data. The error is in optim, which founds: Error in optim(par = c(0.2, 0.5), fn = function (p) : initial value in 'vmmin' is not finite Yes, I know it's a common problem, and I've caref

Re: [R] Error in optim

2011-10-28 Thread R. Michael Weylandt
Why don't you try substituting your vector of values and see what comes out...once you figure out what happened, the sum() command will solve your problems. Michael On Oct 28, 2011, at 5:10 PM, djbanana wrote: > I understand that the likelihood function is a product and hence the log > likel

Re: [R] Error in optim

2011-10-28 Thread djbanana
I understand that the likelihood function is a product and hence the log likelihood function is a sum. However I can't figure out what the problem is. Here's the likelihood function: [(alpha1*beta2*gamma)^v1 exp^(-alpha1*beta2*gamma)]/v1! * [(alpha2*beta1)^v2 exp^(-alpha2*beta1)]/v2! Isn't the l

Re: [R] Error in optim

2011-10-28 Thread Daniel Malter
The likelihood function is a product. Thus, the log likelihood function is a sum. Your log.lik statement, however, fails to compute the sum, which it should minimize. Hence your optim statement does not know what to optimize because log.lik is a vector of the length of the number of observations in

[R] Error in optim

2011-10-28 Thread djbanana
I am trying to run this code and obtain the MLEs for my parameters. However I am getting this error at the end. Error in optim(c(1.4, 1.1, 0.8, 0.92, 0.4), poisson.lik, v = v) : objective function in *optim evaluates to length 100 not 1* Code: poisson.lik <- function(theta,v){ v=matrix(c(1,3,2

Re: [R] Error in optim function.

2011-09-26 Thread Rolf Turner
(a) This is pretty obviously homework; the r-help list is *not* for giving help with homework. (b) *Read* the error message! (c) Your expression for the log likelihood is wrong in more than one way. (The number of observations is *not* the same thing as the number of trials for a given observa

Re: [R] Error in optim function.

2011-09-26 Thread Berend Hasselman
jango wrote: > > I'm trying to calculate the maximum likelihood estimate for a binomial > distribution. Here is my code: > > y <- c(2, 4, 2, 4, 5, 3) > n <- length(y) > binomial.ll <- function (pi, y, n) {## define log-likelihood > output <- y*log(pi)+(n-y)*(log(1-pi)) > return(outp

[R] Error in optim function.

2011-09-26 Thread jango
I'm trying to calculate the maximum likelihood estimate for a binomial distribution. Here is my code: y <- c(2, 4, 2, 4, 5, 3) n <- length(y) binomial.ll <- function (pi, y, n) {## define log-likelihood output <- y*log(pi)+(n-y)*(log(1-pi)) return(output) } binomial.mle <- optim(0.01,

Re: [R] error in optim, within polr(): "initial value in 'vmmin' is not finite"

2011-02-18 Thread Ben Haller
An update for the benefit of the list/posterity: I resolved this issue by switching over to using the lrm() function of package rms. It seems to pick better starts, or something; in any case, it has been able to converge on a solution for every model I've tried, although for the most complex

[R] error in optim, within polr(): "initial value in 'vmmin' is not finite"

2011-02-16 Thread Ben Haller
Hi all. I'm just starting to explore ordinal multinomial regression. My dataset is 300,000 rows, with an outcome (ordinal factor from 1 to 9) and five independent variables (all continuous). My first stab at it was this: pomod <- polr(Npf ~ o_stddev + o_skewness + o_kurtosis + o_acl_1e + di

[R] Error in optim when i call it from a function

2008-11-14 Thread Borja Soto Varela
Dear R-users I've got the next problem: I've got this *function*: fitcond=function(x,densfun,pcorte,start,...){ myfn <- function(parm,x,pcorte,...) -sum(log(dens(parm,x,pcorte,...))) Call <- match.call(expand.dots = TRUE) if (missing(start)) start <- NULL dots <- names(li

[R] Error in optim while using fitdistr() function

2008-02-10 Thread Jason Q. McClintic
I get the digest, so I apologize if this is a little late. For your situation (based on the description and what I think your code is doing, more on that below), it looks like you are modeling a Poisson flow where the number of hits per unit time is a random integer with some mean value. If I

Re: [R] Error in optim while using fitdistr() function for estimationof parameters

2008-02-09 Thread Aswad Gurjar
www.cmis.csiro.au/bill.venables/ > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Aswad Gurjar > Sent: Sunday, 10 February 2008 4:17 PM > To: r-help@r-project.org > Subject: [R] Error in optim while using fitdistr() function

Re: [R] Error in optim while using fitdistr() function for estimationof parameters

2008-02-09 Thread Bill.Venables
-project.org Subject: [R] Error in optim while using fitdistr() function for estimationof parameters Hello, I am trying to fit distribution for data consisting of 421 readings.It is basically no of requests arrived per minute.It contains many 0 entries as no of requests.When i use fd<-fitdistr

[R] Error in optim while using fitdistr() function for estimation of parameters

2008-02-09 Thread Aswad Gurjar
Hello, I am trying to fit distribution for data consisting of 421 readings.It is basically no of requests arrived per minute.It contains many 0 entries as no of requests.When i use fd<-fitdistr(V2,"gamma") I get following error: Error in optim(x = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L

Re: [R] Error in optim while using fitdistr() function

2008-02-09 Thread Aswad Gurjar
> > Hello, > > I am trying to fit distribution for data consisting of 421 readings.It is > basically no of requests arrived per minute.It contains many 0 entries as > no of requests.When i use > fd<-fitdistr(V2,"gamma") > I get following error: > Error in optim(x = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,

[R] Error in optim while using fitdistr() function

2008-02-09 Thread Aswad Gurjar
Hello, I am trying to fit distribution for data consisting of 421 readings.It is basically no of requests arrived per minute.It contains many 0 entries as no of requests.When i use fd<-fitdistr(V2,"gamma") I get following error: Error in optim(x = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,