An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090603/8da69d90/attachment-0001.pl>
code for double sum
3 messages · Roslina Zakaria, Philipp Pagel, Jim Lemon
On Wed, Jun 03, 2009 at 03:02:26AM -0700, Roslina Zakaria wrote:
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:
?
source(.trPaths[5], echo=TRUE, max.deparse.length=10000)
Error in source(.trPaths[5], echo = TRUE, max.deparse.length = 10000) : ? C:\Documents and Settings\zakry001\Application Data\Tinn-R\tmp\selection.r: unexpected end of input at 9: )
Looks like you are missing a closing brace. cu Philipp
Dr. Philipp Pagel Lehrstuhl f?r Genomorientierte Bioinformatik Technische Universit?t M?nchen Wissenschaftszentrum Weihenstephan 85350 Freising, Germany http://webclu.bio.wzw.tum.de/~pagel/
Roslina Zakaria wrote:
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:
source(.trPaths[5], echo=TRUE, max.deparse.length=10000)
Error in source(.trPaths[5], echo = TRUE, max.deparse.length = 10000) : C:\Documents and Settings\zakry001\Application Data\Tinn-R\tmp\selection.r: unexpected end of input at 9: )
ff2(bb,eta,z,10)
Error in ff2(bb, eta, z, 10) : unused argument(s) (10)
Hi Rosalina, You're missing one right brace in your function definition. Jim