How to write a code Newton Raphson code in R involving integration and Bessel function

Posted by Ahmed on Stack Overflow See other posts from Stack Overflow or by Ahmed
Published on 2014-08-17T13:13:33Z Indexed on 2014/08/19 22:20 UTC
Read the original article Hit count: 334

I have want to estimate the parameters of the function which involves Bessel function and integration. However, when i tried to run it, i got a message that "Error in f(x, ...) : could not find function "BesselI" ". I don't know to fix it and would appreciate any related proposal.

library(Bessel)

library(maxLik)

library(miscTools)

K<-300

f <- function(theta,lambda,u) {exp(-u*theta)*BesselI(2*sqrt(t*u*theta*lambda),1)/u^0.5}

F <- function(theta,lambda){integrate(f,0,K,theta=theta,lambda=lambda)$value}

tt<-function(theta,lambda){(sqrt(lambda)*exp(-t*lambda)/(2*sqrt(t*theta)))(theta(2*t*lambda-1)*F(theta,lambda)}

loglik <- function(param) {

theta <- param[1]

lambda <- param[2]

ll <-sum(log(tt(theta,lambda))) }

t<-c(24,220,340,620,550,559,689,543)

res <- maxNR(loglik, start=c(0.001,0.0005),print.level=1,tol = 1e-08)

summary(res)

© Stack Overflow or respective owner

Related posts about r

    Related posts about integration