Displaying 16 results from an estimated 16 matches for "lfactorial".
Did you mean:
factorial
2006 Jul 22
1
ifelse command
...arameters,y,x1,x2)
{
p<-parameters[1]
alpha1<-parameters[2]
beta1<-parameters[3)]
delta1<-parameters[4]
alpha2<-parameters[5]
mu<-alpha1*((x1)^beta1)*exp(-delta1*(x1^alpha2))
if(y>0 & x1>0 & x2==1,
L<-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)
)
else
if(y>0 & x1>0 & x2==2,
L<-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)
)
else
if(y>0 & x1>0 & x2==3,
L<-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)
)
else
L
}
Than...
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]...
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)
{
2006 Jul 22
1
Why the contrain does not work for selecting a particular range of data?
...low:
function (parameters,y1,x11)
{
p<-parameters[1]
alpha1<-parameters[2]
beta1<-parameters[3]
delta1<-parameters[4]
lamda1<-parameters[5]
mu<-alpha1*((x11)^beta1)*exp(-delta1*(x11^lamda1))
ifelse(y1>0|x11>0,
L<-lgamma(y1+p)+p*(log(p)-log(mu+p))+y1*(log(mu)-log(mu+p))-lfactorial(y1)-lgamma(p)
,Inf)
L
}
This is working for me.
2 Way two: I select the data whose x2=1 in the whole range of data. It works but it is not right comparing the value of MLE. the program is:
function (parameters,y,x1,x2)
{
p<-parameters[1]
alpha1<-parameters[2]
beta1<-paramet...
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]
...e of what the wrong is?
Thanks!
Xin
My function is:
function (parameters,y,x1,x3)
{
alpha<-parameters[1:10];
beta<-parameters[11];
g<-parameters[12];
theta<-parameters[13];
j=x3
p=alpha[j]*(x1^beta)*exp(-g*x1)
ifelse(x1>0,
L<-lgamma(y+p)+p*log(theta)+y*(log(1-theta))-lfactorial(y)-lgamma(p)
,Inf)
L
}
[[alternative HTML version deleted]]
2012 Jan 13
1
Brillouin index
Dear colleagues.
I wonder if anybody knows about a procedure in R to calculate the Brillouin Diversity index.
I searched the net but did not find anything about it.
Thanks a lot for any help
Best, Philipp
***************************************************
Prof. Dr. Philipp Fischer
Head of AWI Center for Scientific Diving & Dept. In situ Ecology
Section Shelf Sea Systems
2011 Feb 01
6
help
PLEASE HELP
I actually want to do the following:
a[j] = (1/(j!))*Π (i-1-d), j = 500, Π means product i = 1 to
j
Yet, j! will stop at 170 and Π (i-1-d) at 172; so, a[j] will
not exceed 170.
I would like to have at least 200 a[j].
WHAT SHOULD I DO?
PLEASE SEE MY CODE FOR DETAIL!!
####################################################
R CODE:
2006 May 16
1
r-help@stat.math.ethz.ch
...is:
function (parameters, y1,x11)
{
p<-parameters[1]
alpha1<-parameters[1]
beta1<-parameters[2]
delta1<-parameters[3]
mu<-alpha1+beta1*(x11)+delta1*(x11^2)
ifelse(y1>=0|x11>=0,
L<-
lgamma(y1+p)+p*(log(p)-log(mu+p))+y1*(log(mu)-log(mu+p))
-lfactorial(y1)-lgamma(p)
,Inf)
L
}
I got outputs even it sounds a problem for delata. Actually, there is a mistake made for the parameters (p & alpha1) set up. If I correct them as:
p<-parameters[1]
alpha1<-parameters[2]
beta1<-parameters[3]
delta1<-parameters[4]
Then err...
2008 Jul 09
1
Loglikelihood for x factorial?
Hi Rers,
I have a silly question. I don't know how to express the loglikelihood
function of
1/(x!) where x=x1,x2,....xn in R.
Could anyone give me a hint?
Thank you in advance.
Chunhao Tu
2011 May 09
1
Stirlings Approximation
I have some big combinations like:
4444444444444444444444444444 choose 784645433
Can R compute these?
Is there any package that does stirlings approximation in R?
--
Thanks,
Jim.
[[alternative HTML version deleted]]
2008 Aug 12
2
Maximum likelihood estimation
Hello,
I am struggling for some time now to estimate AR(1) process for commodity price time series. I did it in STATA but cannot get a result in R.
The equation I want to estimate is: p(t)=a+b*p(t-1)+error
Using STATA I get 0.92 for a, and 0.73 for b.
Code that I use in R is:
p<-matrix(data$p) # price at time t
lp<-cbind(1,data$lp) # price at time t-1
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
2007 Jan 06
2
negative binomial family glm R and STATA
Dear Lister,
I am facing a strange problem fitting a GLM of the negative binomial
family. Actually, I tried to estimate theta (the scale parameter)
through glm.nb from MASS and could get convergence only relaxing the
convergence tolerance to 1e-3. With warning messages:
glm1<-glm.nb(nbcas~.,data=zonesdb4,control=glm.control(epsilon = 1e-3))
There were 25 warnings (use warnings() to see
2004 Apr 12
1
R 1.9.0 is release
...d by the
predict() method for loess to return a suitable array.
o factanal(), loess() and princomp() now explicitly check for
numerical inputs; they might have silently coded factor
variables in formulae.
o New functions factorial(x) defined as gamma(x+1) and for
S-PLUS compatibility, lfactorial(x) defined as lgamma(x+1).
o findInterval(x, v) now allows +/-Inf values, and NAs in x.
o formula.default() now looks for a "terms" component before a
'formula' argument in the saved call: the component will have
`.' expanded and probably will have the original env...
2004 Apr 12
1
R 1.9.0 is release
...d by the
predict() method for loess to return a suitable array.
o factanal(), loess() and princomp() now explicitly check for
numerical inputs; they might have silently coded factor
variables in formulae.
o New functions factorial(x) defined as gamma(x+1) and for
S-PLUS compatibility, lfactorial(x) defined as lgamma(x+1).
o findInterval(x, v) now allows +/-Inf values, and NAs in x.
o formula.default() now looks for a "terms" component before a
'formula' argument in the saved call: the component will have
`.' expanded and probably will have the original env...