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

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

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

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

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

2008-02-09 Thread Aswad Gurjar
Hello, Thank You for response.Yes,It is discrete data.I have tried discrete model using goodfit() test.But that too is not working.Is there any other test for discrete data? When I try goodfit() test for discrete distribution: gf<-goodfit(x[[1]],type= "nbinomial",method= "MinChisq") where x[[1]]

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

2008-02-09 Thread Bill.Venables
Chenge your model, most likely. You are telling us a) the response is discrete and b) there is a substantial probability that the value is zero. The gamma distributon is a model for a continuous response, your response is integer valued. Perhaps you should consider something the Poisson or Negati

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,