chamilka wrote > > I have an extended binomial distribution which has the following form: > > http://r.789695.n4.nabble.com/file/n4635699/kb.png > > Here alpha and beta are two parameters and x=0,1,2,3,...n (alike the > binomial distribution) > I am writing a function to find out the densities (probabilities) of this > distribution for given values of alpha and beta. The below is the my > function... > > dnewdis<-function(x,a,b,n) { > term<-0 > for (j in 0:exp(10)) { > term=term+(((-1)**i)*(choose(b-1,i))*(beta(x+a+a*i,n-x+1))) > } > s=a*b*choose(n,x)*term > return(s) > } >
The error is the line for (j in 0:exp(10)) { Shouldn't that be for (i in 0:exp(10)) { When I use this line results appear to be more in line with what you are expecting. Berend -- View this message in context: http://r.789695.n4.nabble.com/Declaring-a-density-function-with-for-loop-tp4635699p4635706.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.