similar to: For and while in looping

Displaying 20 results from an estimated 400 matches similar to: "For and while in looping"

2010 Feb 10
1
looping problem
Hi R-users,   I have this code here: library(numDeriv)   fprime <- function(z) { alp  <- 2.0165;   rho  <- 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
2010 Jan 26
1
newton method for single nonlinear equation
Hi r-users,   I would like to solve for z values using newton iteration method.  I 'm not sure which part of the code is wrong since I'm not very good at programming but would like to learn.  There seem to be some output but what I expected is a vector of z values.  Thank you so much for any help given.   newton.inputsingle <- function(pars,n) {  runi    <- runif(974, min=0, max=1)
2010 Jan 26
1
Newton method
Hi r-users,   I hope somebody can help me with this code. I would like to solve for z values using newton iteration method.  I 'm not sure which part of the code is wrong since I'm not very good at programming but would like to learn.  There seem to be some output but what I expected is a vector of z values.  Thank you so much for any help given.   newton.inputsingle <-
2010 Feb 09
1
how to adjust the output
Hi R-users,   I have this code below and I understand the error message but do not know how to correct it.  My question is how do I get rid of “with absolute error < 7.5e-06” attach to value of cdf so that I can carry out the calculation.   integrand <- function(z) { alp  <- 2.0165   rho  <- 0.868   # simplified expressions   a      <- alp-0.5   c1     <-
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)   {
2007 Sep 22
0
error messages
Hi, I have a density that I need to get MLEs from, which includes definite integrals both in the denominator and in the numerator of the density function. It looks like the outcome depends on the initial values given. My program is shown below: library(circular) ######################################## 4 parameters ######################################## z<-rvonmises(100,0,1)
2003 Aug 20
2
Method of L-BFGS-B of optim evaluate function outside of box constraints
Hi, R guys: I'm using L-BFGS-B method of optim for minimization problem. My function called besselI function which need non-negative parameter and the besselI will overflow if the parameter is too large. So I set the constraint box which is reasonable for my problem. But the point outside the box was test, and I got error. My program and the error follows. This program depends on CircStats
2007 Jun 18
1
two bessel function bugs for nu<0
#bug 1: besselI() for nu<0 and expon.scaled=TRUE #tested with R-devel (2007-06-17 r41981) x <- 2.3 nu <- -0.4 print(paste(besselI(x, nu, TRUE), "=", exp(-x)*besselI(x, nu, FALSE))) #fix: #$ diff bessel_i_old.c bessel_i_new.c #57c57 #< bessel_k(x, -alpha, expo) * ((ize == 1)? 2. : 2.*exp(-x))/M_PI #--- #> bessel_k(x, -alpha, expo) * ((ize == 1)? 2. :
2009 Jun 03
2
code for double sum
Hi R-users,   I wrote a code to evaluate double sum as follows:   ff2 <- function(bb,eta,z,k) { r <- length(z) for (i in 1:r) { sm1 <- sum((z[i]*bb/2)*(psigamma((0:k)+eta+1,deriv=0)/(factorial(0:k)*gamma((0:k)+eta+1))))  sm2 <- sum((besselI(z[i]*bb,eta)*log(z[i]*bb/2) - sm1)/besselI(z[i]*bb,eta))  sm2 } ff2(bb,eta,z,10)     but it gave me the following message:   >
2010 Jun 15
1
Error in nlm : non-finite value supplied by 'nlm'
Hello, I am trying to compute MLE for non-Gaussian AR(1). The error term follows a difference poisson distribution. This distribution has one parameter (vector[2]). So in total I want to estimate two parameters: the AR(1) paramter (vector[1]) and the distribution parameter. My function is the negative loglikelihood derived from a mixing operator. f=function(vector)
2007 Sep 11
1
Fitting Data to a Noncentral Chi-Squared Distribution using MLE
Hi, I have written out the log-likelihood function to fit some data I have (called ONES20) to the non-central chi-squared distribution. >library(stats4) >ll<-function(lambda,k){x<-ONES20; 25573*0.5*lambda-25573*log(2)-sum(-x/2)-log((x/lambda)^(0.25*k-0.5))-log(besselI(sqrt(lambda*x),0.5*k-1,expon.scaled=FALSE))} > est<-mle(minuslog=ll,start=list(lambda=0.05,k=0.006))
2010 Jun 15
0
nlm is
Hello, I am trying to compute MLE for non-Gaussian AR(1). The error term follows a difference poisson distribution. This distribution has one parameter (vector[2]). So in total I want to estimate two parameters: the AR(1) paramter (vector[1]) and the distribution parameter. My function is the negative loglikelihood derived from a mixing operator. f=function(vector)
2004 Dec 14
1
increase thr range in R
Hello Everybody in order to get some needed results out of my function i need to get my besselI function evaluated at some values which normally gave Inf or 0 (expon.scaled NAN) back. So I would like to increase the range in R from approxamittly 1e+320 to aabout 1e+500 or something like that. Is there any possibility or pacckage to do this easily? Thank You Sebastian Kaiser Institut for Statistics
2009 Aug 20
1
how to compute this summation...
Dear R users, I try to compute this summation, http://www.nabble.com/file/p25054272/dd.jpg where f(y|x) = Negative Binomial(y, mu=exp(x' beta), size=1/alp) http://www.nabble.com/file/p25054272/aa.jpg http://www.nabble.com/file/p25054272/cc.jpg In fact, I tried to use "do.call" function to compute each u(y,x) before the summation, but I got an error, "Error in X[i, ]
2002 Oct 17
1
underflow handling in besselK (PR#2179)
The besselK() function knows about overflows/underflows internally; there is a constant xmax_BESS_K in src/nmath/bessel.h (and referred to only in bessel_k.c), equal to 705.342, which is checked if expon.scaled is FALSE. (The equivalent number for bessel_i.c is 709, defined as exparg_BESS in bessel.h.) However, besselK(x) silently returns +Inf if x>705.342. This behavior is reasonable for
2002 Oct 23
1
vectorizing a function
Dear R-xperts I have just written a little hypergeometric function, included below [the hypergeometric function crops up when solving a common type of ODE]. It works fine on single values of the primary argument z, but vectorizing it is getting confusing. The best I have come up with so far just tests for z being longer than 1 and if so, uses sapply() recursively. This is fine, except that it
2001 Sep 21
0
R 1.3.1 fails 'make check' on arm in the Bessel example (PR#1097)
Debian tries to build its packages on a variety of platforms. The arm platform compiled 0.90.1 (the last Debian release before the Debian package required an Atlas library, something we no longer require) failed in 'make check'. The log snippet follows; I traced this to the example(Bessel) code. > matplot(nu, t(outer(xx,nu, besselI)), type = 'l', ylim = c(-50,200), +
2003 Nov 07
0
error message using ARM cpu with Debian
I post this message on R-help mailing list but someone emailed me that I can get helped if I post this one on R-devel mailing list. I have a small handheld pc having ARM process as a CPU. I installed debian and installed R (R-1.7.0 base and core, help html, latex-help) using apt-get command. Everything worked great except for drawing even simple graphs x <- 1:10 plot(x) I got error
2003 Nov 06
1
some error messages using arm cpu with Debian
I have a small handheld pc having ARM process as a CPU. I installed debian and installed R using apt-get command. Everything worked great except for drawing even simple graphs x <- 1:10 plot(x) I got error messages 1: Nonfinite axis limits [GScale(nan,nan,1, .); log=0] 2: relative range of values = 9.0072e+15 * EPS, is small (axis 1). 3: Nonfinite axis limits
2010 Nov 06
1
saddle points in optim
Hi, I've been trying to use optim to minimise least squares for a function, and then get a guess at the error using the hessian matrix (calculated from numDeriv::hessian, which I read in some other r-help post was meant to be more accurate than the hessian given in optim). To get the standard error estimates, I'm calculating sqrt(diag(solve(x))), hope that's correct. I've found