search for: newton_gam

Displaying 3 results from an estimated 3 matches for "newton_gam".

2010 Feb 15
1
error message error
Hi r-users,   I hope somebody can help me to understand the error message.  Here is my code; ## Newton iteration newton_gam <- function(z) { n   <- length(z)   r   <- runif(n)   tol <- 1E-6   cdf <- vector(length=n, mode="numeric")   fprime <- vector(length=n, mode="numeric")   f   <- vector(length=n, mode="numeric")     for (i in 1:1000)   { cdf  <- integrate(fprime...
2010 Feb 10
1
looping problem
...o  <- 0.868;   # simplified expressions   a      <- alp-0.5   c1     <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)   c2     <- sqrt(rho)/(1-rho)   t1     <- exp(-z/(1-rho))   t2     <- (z/(2*c2))^a   bes1   <- besselI(z*c2,a)   t1bes1 <- t1*bes1   c1*t1bes1*t2 }   ## Newton iteration newton_gam <- function(z) { n   <- length(z)   r   <- runif(n)   tol <- 1E-6   cdf <- vector(length=n, mode="numeric")     for (i in 1:1000)   { # numerical intergration to find the cdf     cdf  <- integrate(fprime, lower = 0, upper = z)$value       # Newton method     z    <- z...
2010 Feb 09
0
For and while in looping
...t;- 0.868;   # simplified expressions   a      <- alp-0.5   c1     <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)   c2     <- sqrt(rho)/(1-rho)   t1     <- exp(-z/(1-rho))   t2     <- (z/(2*c2))^a    bes1   <- besselI(z*c2,a)   t1bes1 <- t1*bes1    c1*t1bes1*t2 }   ## Newton iteration newton_gam <- function(z) { n   <- length(z)   r   <- runif(n)   tol <- 1E-6     for (i in 1:n)   { # numerical intergration to find the cdf     cdf[i]  <- integrate(fprime, lower = 0, upper = z[i])$val         # Newton method     z[i]    <- z[i] - (cdf[i] - r[i])/fprime(z[i])   }   z }  ...