Displaying 20 results from an estimated 2000 matches similar to: "Summary: Factorial function in R"
2003 Jun 13
1
Factorial function in R?
Is there a native factorial function in R [my searches have been
fruitless], or do I need to use gamma() function?
*********************************************************************
Dr Peter Caley
CSIRO Entomology
GPO Box 1700, Canberra,
ACT 2601
Email: peter.caley@csiro.au
Ph: +61 (0)2 6246 4076 Fax: +61 (0)2 6246 4000
*********************************************************************
2004 Jul 16
0
Does AIC() applied to a nls() object use the correctnumber of estimated parameters?
Thanks Adaikalavan, however the problem remains.
Considering AIC() as applied to the linear model in AIC() help
documentation:
> data(swiss)
> lm1 <- lm(Fertility ~ . , data = swiss)
> AIC(lm1)
[1] 326.0716
Clearly this includes the estimation of the residual standard error as
an estimated parameter, as this gives the correct score:
> -2*logLik(lm1) + 2*(length(coef(lm1))+1)
2004 Jul 16
1
Does AIC() applied to a nls() object use the correct number of estimated parameters?
I'm wondering whether AIC scores extracted from nls() objects using
AIC() are based on the correct number of estimated parameters.
Using the example under nls() documentation:
> data( DNase )
> DNase1 <- DNase[ DNase$Run == 1, ]
> ## using a selfStart model
> fm1DNase1 <- nls( density ~ SSlogis( log(conc), Asym, xmid, scal ),
DNase1 )
Using AIC() function:
>
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
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
2012 Oct 11
2
model selection with spg and AIC (or, convert list to fitted model object)
Dear R Help,
I have two nested negative log-likelihood functions that I am optimizing
with the spg function [BB package]. I would like to perform model
selection on these two objective functions using AIC (and possibly
anova() too). However, the spg() function returns a list and I need a
fitted model object for AIC(), ICtab() [bbmle package], or anova().
How can I perform AIC-based model
2012 Sep 27
0
problems with mle2 convergence and with writing gradient function
Dear R help,
I am trying solve an MLE convergence problem: I would like to estimate
four parameters, p1, p2, mu1, mu2, which relate to the probabilities,
P1, P2, P3, of a multinomial (trinomial) distribution. I am using the
mle2() function and feeding it a time series dataset composed of four
columns: time point, number of successes in category 1, number of
successes in category 2, and
2009 Nov 02
1
need help in using Hessian matrix
Hi
I need to find the Hessian matrix for a complicated function from a certain
kind of data but i keep getting this error
Error in f1 - f2 : non-numeric argument to binary operator
the data is given by
U<-runif(n)
Us<-sort(U)
tau1<- 2
F1tau<- pgamma((tau1/theta1),shape,1)
N1<-sum(Us<F1tau)
X1<- Us[1:N1]
2002 Jan 16
1
factorials
I'm a total newbie at using R, and so there probably
is a better way to do this. However, I couldn't find
one, and so maybe this will help someone.
I was calculating log-likelihoods using a multinomial
model, and found that for large n, prod(n:1) wouldn't
work to calculate factorials (e.g., prod(200:1) =
Inf). The below function calculates the natural log
of a factorial (e.g.
2007 Oct 29
2
help please
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.
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.
thanks
Aruike
pp=function(x,n,M){z=1.0;a=2.3071430;b=7.266064;H=3
out.h=c()
out.y=c()
out.m=c()
out.prob=c()
2011 Feb 11
1
Using merge
Hi,
I have two tables and I need to merge both. I use the merge command, but
in this way the name must be exactly. How I can make to compare
independently of upper or lower-case?
Look:
data1<-data.frame(journal=c("Ecology","Environmental
Entomology","Neotropical Biology And Conservation"))
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
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
2007 Oct 25
1
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
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]
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
2005 Apr 04
1
Handling very large integers with factorial and combinat (nCm)
Dear list,
perhpas this question is more suitable for R-dev but since I am not
really a developer I post it here first.
Apparently the following lines do not create any problem in R:
library(combinat)
r <- 20; b <- 2;
sum( sapply(0:r,function(x) nCm(r,x)^(2*b)) ) > 2^64
while in C I obtain an overflow of data even using unsigned long long
and with long double I incurr in precision
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.
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 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