I have the following R code:
beta <- 3.2
sigma <- 1.2
mu <- beta - tau
integrand <- function(Ti){
r <- Ti*dlnorm(x = Ti, meanlog = mu, sd = sigma)
return(r)
}
tau <- -5:5
quadinf(integrand, 0, Inf)$Q
I am trying to calculate the integral as shown in the code using the quadinf function from the pracma package, however, I am getting the following error:
Error in if (delta < tol) break : the condition has length > 1
In the documentation of the quadinf function it says:
The integrand function needs not be vectorized.
So I am assuming that the error could be connected to my integrand function being vectorized? But then how can I make it not vectorized? Or is the problem somewhere else?