SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: optim - hypergeometric function and constraint on argument [ Reply ]
By: Arne Henningsen on 2014-10-24 20:29
[forum:41581]
Dear Graziella

I think that the problem in your example that causes the warning message "the condition has length > 1 [...]" is that object "x" is a vector. Hence, the expression "abs(-exp((-x + eta[8])/eta[7]))" is also a vector and the expression "abs(-exp((-x + eta[8])/eta[7])) > 1" is a vector of boolean values. However the "if" command only takes into account the first element of this vector of boolean values. The errors may be related to the problem in the if() condition.

This forum is about the R package "maxLik" but it seems that your problem is not related to this R package. Please ask questions that are not related to the maxLik package at other places (e.g. the R-help mailing list).

Best regards,
Arne

optim - hypergeometric function and constraint on argument [ Reply ]
By: Graziella Bonanno on 2014-10-24 10:35
[forum:41579]
Dear All,
I'm trying to optimization a log-likelihood function which argument is the error of a model y-x*betas, where y and x are observed (I have a sample of 54 manufactuirng firms).
The density function is a combination of 4 Hypergeometric functions, then I have to consider more than one constraint. One of these is on the argument.

When I launch the optim command, I obtain the following error message:

"Error in optim(iv, ll_prodf, method = "L-BFGS-B", lower = c(0.1, 0.3, :
L-BFGS-B needs finite values of 'fn'
In addition:
In if (abs(-exp((-x + eta[8])/eta[7])) > 1) a = exp(99999) else -(sum(log((1 - ... :
the condition has length > 1 and only the first element will be used"


I tried to maximize also with optimConstr. The error messages are as follows:

"Error in obj * sign(mu) > obj.old * sign(mu) :
invalid comparison with complex values
In addition:
1: In h[1] <- x - eta[8] :
number of items to replace is not a multiple of replacement length 10
2: In if (abs(-exp((-x + eta[8])/eta[7])) > 1) a = exp(99999) else -(sum(log((1 - ... :
the condition has length > 1 and only the first element will be used"


Where can I find th descriptions of this kind of errors?
My problem (in addition to this maximization) is that I cannot interpret the error messages.

Thank you,
Graziella

Thanks to:
Vienna University of Economics and Business Powered By FusionForge