Displaying 20 results from an estimated 10000 matches similar to: "help me to debug this part of code?"
2004 Jun 26
1
S4 group "Math", "getGroupMembers", "genericForPrimitive"
Hi,
I found the following on Windows 2000/NT
R Version 1.9.1 (2004-06-21) (also Version 1.9.0):
The S4 group "Math" doesn't work as documented; i.e., "log", "log10",
"gamma" and "lgamma" are included
in the documentation but don't work. See example code below.
Moreover, what about 'genericForPrimitive' which is used
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
2011 Aug 17
1
multinomRob - error message
Hi,
I would like to use the multinomRob function to test election results.
However, depending on which independent variables I include and how
many categories I have in the dependent variable, the model cannot be
estimated.
My data look like this (there are 68 observations):
> head(database)
RESTE09 GAUCHE09 PDC09 PLR09 UDC09 MCG09 RESTE05 GAUCHE05 PDC05
D1 1455
2000 Mar 14
1
qr.solve (fwd)
Two friend reported me a problem, which I can't solve:
(I run R-1.0.0, Debian Linux)
They hava a function "corr.matrix" (see end of mail), and when they
create a 173x173 matrix with this function
V <- corr.matrix(0.3, n=173)
V1 <- qr.solve(V)
reports:
Error in qr(a, tol = tol) : NA/NaN/Inf in foreign function call (arg 1)
For n < 173, qr.solve returns the correct
2000 Oct 04
2
gamma and lgamma functions (PR#684)
The following seems very strange:
> lgamma(-0.04)
[1] 3.243307
> gamma(-0.04)
[1] -25.61830
Jim
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 the subject !) To:
2002 Dec 22
1
lgamma(-0.8)=?
Dear R users:
I wonder anyone is aware of such a thing from lgamma()
> lgamma(-0.8)
[1] 1.747207
I thought it should be NA as in S-PLUS. Both R-1.3.1 and R-1.5.1
report this result. I don't have the latest R-1.6.1 so I don't
know whether this is corrected or not.
Happy holidays,
Paul.
2009 Jan 05
1
transform R to C
Dear R users,
i would like to transform the following function from R-code to C-code and call it from R in order to speed up the computation because in my other functions this function is called many times.
`dgcpois` <- function(z, lambda1, lambda2)
{
`f1` <- function(alpha, lambda1, lambda2)
return(exp(log(lambda1) * (alpha - 1) - lambda2 * lgamma(alpha)))
`f2` <-
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
2007 Oct 14
1
Extending deriv3()
Hello,
I was wondering if the functions deriv3(), deriv() etc. could be extended
to handle psigamma() and its special cases (digamma(), trigamma()
etc.). From the error message it seems that 'psigamma' needs to be
added to the derivatives table.
This might be easy since psigamma() has a deriv argument.
Additionally, this error message is also obtained when requesting for
the Hessian of
1998 Sep 10
2
R-beta: trouble compiling 0.62.3 on SunOS 4.1.4: lgamma conflicts
I've recently tried to get 0.62.3 up on our Suns (4.1.4, using gcc; I'm
also having trouble with a Solaris 2.6 compile but I haven't given up hope
on that one yet) -- the last compile I did was 0.61.1, which worked
smoothly.
Running
./configure --prefix=/usr/local/apps/R/R-0.62.3 [--with-g77]
(tried both with and without g77, eventually get to the same place),
I get a conflict
2009 Jul 15
1
GLM Gamma Family logLik formula?
Hello all,
I was wondering if someone can enlighten me as to the difference
between the logLik in R vis-a-vis Stata for a GLM model with the gamma
family.
Stata calculates the loglikelihood of the model as (in R notation)
some equivalent function of
-1/scale * sum(Y/mu+log(mu)+(scale-1)*log(Y)+log(scale)+scale*lgamma(1/scale))
where scale (or dispersion) = 1, Y = the response variable, and mu
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
2009 Nov 20
1
Bessel function with large index value
I am looking for a method of dealing with the modified Bessel function
K_\nu(x) for large \nu.
The besselK function implementation of this allows for dealing with
large values of x by allowing for exponential scaling, but there is no
facility for dealing with large \nu.
What would work for me would be an lbesselK function in the manner of
lgamma which returned the log of K_\nu(x) for large
2005 Jul 03
2
over/under flow
I am porting some FORTRAN to R in which an Inf triggers an if(). The
trigger is infinite on exp(lgamma(OVER)). What is the canonical R
style of determining OVER when exp(OVER)== Inf? The code structure
that I am
porting is best left intact--so I need to query R somehow to the value
of OVER that causes exp(lgamma(OVER)) to equal Inf.
On my system,
exp(lgamma(171)) is about first to equal Inf.
2008 Apr 02
3
Fwd: Re: Nonlinear equation
> > >From: robert-mcfadden w o2.pl
> > >Date: 2008/04/02 Wed AM 09:58:28 CDT
> > >To: r-help w r-project.org
> > >Subject: [R] Nonlinear equation
> >
> > hi: you need to give an example and details or
> > you won't get much response, if any.
Equation e.g. (A, B are known constants):
3log(gamma(x))-log(gamma(x)*gamma(2x))+(x-1)*A+B=0
1998 Aug 14
1
R-beta: ld problem/SunOS/gcc/g77
In trying to compile R-0.62.2 on my SPARC SunOS:
tajo% uname -a
SunOS tajo 4.1.3_U1 1 sun4m
with gcc/g77,
I ran into
gcc -o R.binary [deleted] ../lib/libmath.a -L/usr/openwin/lib -lX11 -ldl -ltermcap -lm -lf2c
collect2: ld returned 2 exit status
ld: /lib/libm.a(lgamma.o): _gamma: multiply defined
ld: /lib/libm.a(lgamma.o): _lgamma: multiply defined
*** Error code 1
make: Fatal error:
2010 May 05
1
testInstalledBasic question
Hi,
I'm currently in the process of writing an R-installation SOP for my
company. As part of that process I'm using the recommendations from the 'R
Installation and Administration' document, section 3.2, "Testing an
installation". This is done on an XP machine, using the latest binary of
2.11.0.
The binary is downloaded and then installed from the installer. I then
2011 Feb 09
3
precision of gamma function
Dear R users,
I have to calculate gamma functions for negative numbers beyond -171.4.
e.x. gamma(-500.4)
I got following:
> gamma(-170.4)
[1] -5.824625e-308
> gamma(-171.4)
[1] 0
Warning message:
underflow occurred in 'gammafn'
I have tried to use a recursion getting values a little futher -180.
How could I solve this problem? Thank you beforehand.
Chuse.
2010 Jul 05
2
Function to compute the multinomial beta function?
Dear R-users,
Is there an R function to compute the multinomial beta function? That is, the normalizing constant that arises in a Dirichlet distribution. For example, with three parameters the beta function is Beta(n1,n2,n2) = Gamma(n1)*Gamma(n2)*Gamma(n3)/Gamma(n1+n2+n3)
Thanks in advance for any assisstance.
Regards,
Greg
[[alternative HTML version deleted]]
2005 Dec 05
3
The gamma function and infinity
I have to calculate some formula like:
gamma(x)/(gamma(x+y)
and I observed that for relatively big values of x, R
returns infinity and so cannot compute the formula. Is
it possible to force R to give the real value of
gamma(x) instead of Inf ?
thanks