[R] code for double sum
Philipp Pagel
p.pagel at wzw.tum.de
Wed Jun 3 12:24:07 CEST 2009
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/
More information about the R-help
mailing list