[R] integrate fails with errors

Thomas Lumley tlumley at u.washington.edu
Tue Jul 19 19:53:46 CEST 2005

On Tue, 19 Jul 2005, [iso-8859-1] herodote at oreka.com wrote:

> beta0,eta0,n are initialized as single integer, temp is a 1 dimension array containing 9 integer.
> integrate(function(beta) ((beta/(eta0)^beta)^n)*prod(temp^(1-beta)*exp(-sum(temp^beta)/(eta^beta)))*(1/(sqrt(2*pi))*exp(((beta-beta0)^2,0,Inf)
> R says : The longuest object isn't a multiple of the shortest object in temp^beta , the same for temp^(1-beta).
> I don't understand why R fails to take calculate each temp^beta then sum it over again for each beta values.

The help page for integrate() says
     f: an R function taking a numeric first argument and returning a
           numeric vector of the same length.

Your f is not of that form.


More information about the R-help mailing list