similar to: Stirlings Approximation

Displaying 20 results from an estimated 4000 matches similar to: "Stirlings Approximation"

2009 Dec 15
3
RFC: lchoose() vs lfactorial() etc
lgamma(x) and lfactorial(x) are defined to return ln|Gamma(x)| {= log(abs(gamma(x)))} or ln|Gamma(x+1)| respectively. Unfortunately, we haven't chosen the analogous definition for lchoose(). So, currently > lchoose(1/2, 1:10) [1] -0.6931472 -2.0794415 NaN -3.2425924 NaN -3.8869494 [7] NaN -4.3357508 NaN -4.6805913 Warning message: In
2009 Apr 22
2
integrate lgamma from 0 to Inf
Dear R users, i try to integrate lgamma from 0 to Inf. But here i get the message "roundoff error is detected in the extrapolation table", if i use 1.0e120 instead of Inf the computation works, but this is against the suggestion of integrates help information to use Inf explicitly. Using stirlings approximation doesnt bring the solution too. ## Stirlings approximation lgammaApprox
2006 Jul 22
1
ifelse command
Dear: I try to revise the maximum likelihood function below using something constrains. But it seems something wrong with it. Becasue R would not allow me to edit the function like this. It is very appreciate if you can help. function (parameters,y,x1,x2) { p<-parameters[1] alpha1<-parameters[2] beta1<-parameters[3)] delta1<-parameters[4] alpha2<-parameters[5]
2006 Jul 22
1
Why the contrain does not work for selecting a particular range of data?
Dear: Continuing the issue of 'ifelse'! I selecting the data whose 'x2'=1 for maximizing likelihood. I used two way to do this but the results are different. 1.Way one I use the data for x2=1 and run the program. It works for me. Tthe program is described as below: function (parameters,y1,x11) { p<-parameters[1] alpha1<-parameters[2] beta1<-parameters[3]
2012 Mar 24
1
Solving the equation using uniroot
Hello all, I was going to solve (n-m)! * (n-k)! = 0.5 *n! * (n-m-k)! for m when values of n and k are provided n1<-c(10,13,18,30,60,100,500)         # values of n kx<-seq(1,7,1);                               # values of k slv2<-lapply(n1,function(n){    slv1<-lapply(kx,function(k){              lhs<-function(m)              {                
2001 Dec 04
3
factorial() not here (PR#1194)
Version 1.3.1 (2001-08-31) factorial() is not in R. It is in S-Plus with the definition factorial <- function(n) gamma(n + 1) -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not
2006 Nov 15
1
OPTIM--non finite finite different [13]
Dear All: I used optim() to minimise the loglikelihood function for fitting data to negative binomial distribution. But there initial value of log-likelihood and iteration 10 value are reasonable. for example: initial value 1451657.994524 iter 10 value 47297.534905 iter 20 value -623478636.8236478 Then the iter 20 vlaue suddelnly changes to a negative value and in the end the error mesage is
2000 Jul 06
1
factorial(), modulus()
Dear R friends, I was wondering if there were factorial and modulus functions out there that I've somehow overlooked? -P. -- Peter L. Hurd, Ph.D. phurd at uts.cc.utexas.edu http://www.zo.utexas.edu/research/phurd fax 512.471-3878 Section of Integrative Biology, University of Texas, Austin TX 78712 USA
2011 Oct 27
3
2 x 3 Probability under the null
I have a 2 x 3 matrix called snp and I want to compute the following probability: choose(sum(snp[,1]), snp[1,1]) * choose(sum(snp[,2]), snp[1,2]) * choose(sum(snp[,3]), snp[1,3])/choose(sum(snp), sum(snp[1,])) but I keep getting Infs and NaNs. Is there a function that can do this in R? -- Thanks, Jim. [[alternative HTML version deleted]]
2004 Nov 08
4
About 'choose' function
Hello R-users, When I didn't know about the internal 'choose' function, I made such function, 'my.choose' below. But when I used them instead of choose(6000,20), they didn't give me any answer. What is the difference between 'choose', 'my.choose1', and 'my.choose2' below? That is, what is behind 'choose' function and what's the problem
2009 Apr 22
5
large factorials
I am working on a project that requires me to do very large factorial evaluations. On R the built in factorial function and the one I created both are not able to do factorials over 170. The first gives an error and mine return Inf. Is there a way to have R do these larger calculations (the calculator in accessories can do 10000 factorial and Maple can do even larger) -- View this message in
2011 Jan 07
4
how to calculate this natural logarithm
Hello I want to calculate natural logarithm of sum of combinations as follow: (R code) { com_sum=choose(2000000,482)*choose(1000000,118)+choose(2000000,483)*choose(1000000,117)+...+choose(2000000,i)*choose(1000000,600-i)+...+choose(2000000,600)*choose(1000000,0) #calculate the sum result=log(com_sum) #calculate the log of the sum } But
2011 Aug 22
2
CDFs
Hello all, I have two columns of numbers. I would like to do the following: (1) Plot both cdfs, F1 and F2 on the same graph. (2) Find smoothed approximations of F1 and F2 lets call them F1hat and F2hat (3) Find values for F1hat when we substitue a value of x in it. (4) Find the corresponding densities of the cdfs. Any ideas? -- Thanks, Jim. [[alternative HTML version deleted]]
2011 Feb 11
3
How can we make a vector call a function element-wise efficiently?
Hello I have a time-comsuming program which need to simplify, I have tested the annotated program as follow: > #define function which will be call > calsta <- function(c, n=100000) + { + i <- seq(from=0, length=c) + logx <- lchoose(NT-n, CT-i) + lchoose(n, i) + logmax <- max(logx) + logmax + log(sum(exp(logx - logmax))) + } > CT=6000 #assignment to CT >
2003 May 08
1
AW: approximation of CDF
> Almost any method of fitting a density estimate would work on > integrating (numerically) the result. it is a nice idea concerning the monotony property, which will be obtained automatically, but I am going to use results of approximation analytically > In particular, look at package polspline, where > p(old)logspline does the integration for you. thank you, I am going to
2003 May 08
2
approximation of CDF
Hi all, is there any package in R capable of smooth approximation of CDF basing on given sample? (Thus, I am not speaking about ecdf) In particular, I expect very much that the approximation should subject to the property: f(x0)<=f(x1) for x0<x1, where x0 and x1 belong to range of the sample given. Polynomial approximation could be OK for me as well. P.S.
2004 Sep 30
1
Vectorising and loop (was Re: optim "a log-likelihood function")
>From: Sundar Dorai-Raj <sundar.dorai-raj at PDF.COM> >Reply-To: sundar.dorai-raj at PDF.COM >To: Zhen Pang <nusbj at hotmail.com> >CC: r-help at stat.math.ethz.ch >Subject: Vectorising and loop (was Re: [R] optim "a log-likelihood >function") >Date: Wed, 29 Sep 2004 18:21:17 -0700 > > > >Zhen Pang wrote: > >> >>I also use
2008 Feb 27
1
dhyper, phyper (PR#10853)
Aloha all, I know too little about what I'm about to write and hope I'm not wasting your time. For a class I'm teaching in archaeological data analysis, I'm trying to put together a routine that calculates the so-called Petersen index and, especially, confidence intervals for the index. This was introduced to archaeologists by N.R.J. Fieller and A. Turner in an article
2007 Oct 26
5
help
hello, please can anyone help me out. Am a new user of R program. Am having problem with this code below, not getting the expected results. 1. Each m, the cumulative sum should be 1.000 but the 2nd and 3rd m returned 2.000 and 3.000 instead of 1.000. 2. to get the LCL(m) and UCL(m) for each m base on these instructions if out.cum > 0.025 then LCL(m)= y-1 if out.cum >0.975
2011 Nov 18
3
Permutations
Hi all, why factorial(150) shows the error out of range in 'gammafn'? I have to calculate the number of subset formed by 150 samples taking 10 at a time. How is this possible? best [[alternative HTML version deleted]]