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: ################################################### d = .25 # generate j! v=j=1 for (i in 1:200){ v[i] = i for (i in 2:200){ j[1]=1 j[i] = j[i-1]*v[i] } } j # generate aj l=A=a=0 for (k in 1:200){ l[k] = (k-1-d) for (i in 2:200){ A[1] = l[1] A[i] = A[i-1]*l[i] for ( i in 1:200){ a[i]= (1/j[i])*A[i] } } } a ######################################## END CODE ################## ##################################################################### With GOD, everything is POSSIBLE. Avec DIEU, tout est POSSIBLE. [[alternative HTML version deleted]]
On Feb 1, 2011, at 3:51 PM, Kiogou Lydie wrote:> > I actually want to do the following: > > a[j] = (1/(j!))*? (i-1-d), j = 500, ? means product i = 1 to jWhat is the purpose of this effort?> > 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].> factorial(200) [1] Inf Warning message: In factorial(200) : value out of range in 'gammafn'> > WHAT SHOULD I DO?You should review the mathematics involved in calculating factorials and think more deeply about the limitations of your machine and software. ?factorial> > PLEASE SEE MY CODE FOR DETAIL!! > > > #################################################### > R CODE: > ################################################### > > d = .25 > > # generate j! > v=j=1 > for (i in 1:200){ > v[i] = i > for (i in 2:200){ > j[1]=1 > j[i] = j[i-1]*v[i] > } > } > j > > # generate aj > l=A=a=0 > for (k in 1:200){ > l[k] = (k-1-d) > for (i in 2:200){ > A[1] = l[1] > A[i] = A[i-1]*l[i] > for ( i in 1:200){ > a[i]= (1/j[i])*A[i] > } > > } > } > a > > ######################################## END CODE ################## > ##################################################################### > > > With GOD, everything is POSSIBLE. >Except perhaps calculating unlogged factorials above 170 with 64 bit computers.> Avec DIEU, tout est POSSIBLE. > > > > [[alternative HTML version deleted]]-- David Winsemius, MD West Hartford, CT
On Tue, Feb 01, 2011 at 12:51:18PM -0800, Kiogou Lydie wrote:> > > 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?Computing factorial of 171 and larger numbers may be done using extended arithmetic in Rmpfr as already suggested. Depending on the purpose of computing factorial of large numbers, consider also the function lfactorial(), which computes the logarithm in the standard numeric type. lfactorial(1000) [1] 5912.128 Hope this helps. Petr Savicky.
hello I have recently started using the LOCFIT package, together with Clive Loader's book. I need to implement some method for automatic (plug-in) bandwidth selection in a multivariate kernel regression. From the book, and the LOCFIT documentation, it is not clear whether this is possible. As far as I can see, the only time the various automated procedures, e.g., SJPI, are used is in the kdeb function, which is for preparing a summary comparison of various selection methods, and only for a *univariate kernel density. *Does anyone here know of a way to implement automatic (plug-in) bandwidth selection for kernel regression, maybe with some R function that calls LOCFIT? Or can you suggest a good alternative package for this, either in R/Matlab or a stand-alone? Thanks a lot, and regards
Hi, maybe you rethink your calculations. Just for curiosity, what's the purpose? First of all, using prod(1:j-1-.25) #and prod(1:j) instead of a loop is much more efficent. If you need all values for a[1] up to a[j] you can use cumprod But this doesn't get you rid of numeric overflow but 1/(1*2*3*4*..*j) * (-d)(1-d)(2-d)...(j-1-d) is the same as (-d)/1 * (1-d)/2 * (2-d)/3 ... * (j-1-d)/j (multiplication is commutative) j<-1:500 a<-cumprod((j-1-.25)/j) or am I missing something? Am 01.02.2011 21:51, schrieb Kiogou Lydie:> > > 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: > ################################################### > > > > d = .25 > > # generate j! > v=j=1 > for (i in 1:200){ > v[i] = i > for (i in 2:200){ > j[1]=1 > j[i] = j[i-1]*v[i] > } > } > j > > # generate aj > l=A=a=0 > for (k in 1:200){ > l[k] = (k-1-d) > for (i in 2:200){ > A[1] = l[1] > A[i] = A[i-1]*l[i] > for ( i in 1:200){ > a[i]= (1/j[i])*A[i] > } > > } > } > a > > ######################################## END CODE ################## > ##################################################################### > > > With GOD, everything is POSSIBLE. > > Avec DIEU, tout est POSSIBLE. > > > > [[alternative HTML version deleted]] > > > > > ______________________________________________ > R-help at 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.-- Eik Vettorazzi Institut f?r Medizinische Biometrie und Epidemiologie Universit?tsklinikum Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/7410-58243 F ++49/40/7410-57790
my program run well on my Pc but when run one the server(linux),it meet the error Error in match.fun(FUN) : could not find function "Negate" thx peter [[alternative HTML version deleted]]
Hi, I've been working with R the past few days in trying to get a proper table set up but have not had any luck at all and the manuals I've read have not worked for me either. I was wondering if anyone here would be able to help me in setting this data up in R both as a table and as a bargraph as I have not been able to do it myself. If somebody could help me with doing this and send me an overview in a document on how it should look, I would really appreciate it. Thank you. Laura Diet: Binger-yes: Binger-No: Total: None 24 134 158 Healthy 9 52 61 Unhealthy 23 72 95 Dangerous 12 15 27 [[alternative HTML version deleted]]