search for: choosing

Displaying 20 results from an estimated 16096 matches for "choosing".

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
2020 Jan 13
3
choose(n, k) as n approaches k
This struck me as incorrect: > choose(3.999999, 4) [1] 0.9999979 > choose(3.9999999, 4) [1] 0 > choose(4, 4) [1] 1 > choose(4.0000001, 4) [1] 4 > choose(4.000001, 4) [1] 1.000002 Should base::choose(n, k) check whether n is within machine precision of k and return 1? Thanks, Erik *** sessionInfo() R version 3.6.0 beta (2019-04-15 r76395) Platform: x86_64-apple-darwin15.6.0
2020 Jan 13
3
choose(n, k) as n approaches k
This struck me as incorrect: > choose(3.999999, 4) [1] 0.9999979 > choose(3.9999999, 4) [1] 0 > choose(4, 4) [1] 1 > choose(4.0000001, 4) [1] 4 > choose(4.000001, 4) [1] 1.000002 Should base::choose(n, k) check whether n is within machine precision of k and return 1? Thanks, Erik *** sessionInfo() R version 3.6.0 beta (2019-04-15 r76395) Platform: x86_64-apple-darwin15.6.0
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 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
2001 Dec 13
2
inconsistency between gamma and choose functions
Please can someone explain why I seem to get these contradictory results? choose(5,2) [1] 10 gamma(6)/(gamma(3)*gamma(4)) [1] 10 gamma(6)/(gamma(3)*gamma(4)) == choose(5,2) [1] TRUE # all's well so far. # now look what happens: gamma(21)/(gamma(6)*gamma(16)) == choose(20,5) [1] FALSE # check individual terms: gamma(21)/(gamma(6)*gamma(16)) [1] 15504 choose(20,5) [1] 15504 # so they are the
2020 Jan 14
2
[R] choose(n, k) as n approaches k
> On 14 Jan 2020, at 16:21 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > > On 14/01/2020 10:07 a.m., peter dalgaard wrote: >> Yep, that looks wrong (probably want to continue discussion over on R-devel) >> I think the culprit is here (in src/nmath/choose.c) >> if (k < k_small_max) { >> int j; >> if(n-k < k
2005 Aug 15
1
Anything like dir.choose (similar to file.choose) in R?
Does R have a dir.choose function? I can use file.choose like this as a kludge to get something like a dir.choose, but a real dir.choose would be better: cat("Select one of files in directory to process:\n") filename <- gsub("\\\\", "/", file.choose()) basepath <- dirname(filename) Windows provides a lower-level SHBrowseForFolder function to create such
2012 Sep 06
2
choose() function returning anomalous results (zero instead of one)
Hello, (Apologies for length, wanted to get all the relevant detail in that I know of). I've been having a lot of trouble with some code for an inventory analysis problem I was doing, and finally came to the conclusion that it appears that choose() is returning incorrect values. Specifically: ------------- Browse[1]> nn [1] 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3
2020 Jan 14
4
[R] choose(n, k) as n approaches k
OK, I see what you mean. But in those cases, we don't get the catastrophic failures from the if (k < 0) return 0.; if (k == 0) return 1.; /* else: k >= 1 */ part, because at that point k is sure to be integer, possibly after rounding. It is when n-k is approximately but not exactly zero and we should return 1, that we either return 0 (negative case) or n
2009 Sep 23
1
set choose.files directory?
Hi, I've been trying to set the directory for choose.files as follows: [R2.9.0 running on XP] setwd("C:/Documents and Settings/2/Data") getwd() infile2 = choose.files(filters = Filters[c("txt","All"),], caption = "Choose ECD datafile") #<...do a bunch of stuff...> It appears the working directory isn't updated until after choose.files()
2020 Jan 14
1
[R] choose(n, k) as n approaches k
Yep, that looks wrong (probably want to continue discussion over on R-devel) I think the culprit is here (in src/nmath/choose.c) if (k < k_small_max) { int j; if(n-k < k && n >= 0 && R_IS_INT(n)) k = n-k; /* <- Symmetry */ if (k < 0) return 0.; if (k == 0) return 1.; /* else: k >= 1 */ if n is a near-integer, then k
2006 Aug 24
4
extremely slow recursion in R?
I recently coded a recursion algorithm in R and ir ran a few days without returning any result. So I decided to try a simple case of computing binomial coefficient using recusrive relationship choose(n,k) = choose(n-1, k)+choose(n-1,k-1) I implemented in R and Fortran 90 the same algorithm (code follows). The R code finishes 31 minutes and the Fortran 90 program finishes in 6 seconds. So the
2020 Jan 15
1
[R] choose(n, k) as n approaches k
That crossed my mind too, but presumably someone designed choose() to handle the near-integer cases specially. Otherwise, we already have beta() -- you just need to remember what the connection is ;-). I would expect that it has to do with the binomial and negative binomial distributions, but I can't offhand picture a calculation that leads to integer k, n plus/minus a tiny numerical error
2008 Mar 26
2
choose fails a fundamental property of binomial coefficients (PR#11035)
Full_Name: Jerry W. Lewis Version: 2.7.0 (2008-03-23 r44847) OS: Windows XP Professional Submission from: (NULL) (71.184.230.48) choose(n,k) = choose(n,n-k) is not satisfied if either 1. n is a negative integer with k a positive integer (due to automatically returning 0 for n-k<0) 2. n is not an integer with k a positive integer (due to rounding n-k to an integer, compounded by
2003 Aug 30
3
fisher.test() gives wrong confidence interval (PR#4019)
The problem occurs when the sample odds ratio is Inf, such as in the following example. Given the fact that both upper bounds of the two 95% confidence intervals are Inf, I would have expected that the two lower bounds be equal, but they aren't. x <- matrix(c(9,4,0,2),2,2) x # [,1] [,2] #[1,] 9 0 #[2,] 4 2 rbind("two.sided.95CI"=fisher.test(x)$conf.int,
2010 Mar 02
1
problem with choose.files
I have recently upgraded to R 2.10.1 on Windows XP and am using scripts that I've used in previous versions successfully. I'm having a problem with choose.files. The lines read: fura_scan_file<-choose.files(caption="Select log file (*.log) for fura-2 scans") PI_scan_file<-choose.files(caption="Select log file (*.log) for PI scans") The problem is that the
2011 May 16
1
dir.choose analog of file.choose
Under Windows (and maybe others) you can use file.choose() as a substitute for an explicit file= argument in most places. Is there an analog for what I'll call dir.choose(), so that I can say setwd(dir.choose()) thx, -Michael -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele
2006 Nov 25
2
cat not evaluated before file.choose
As part of a larger function I have code similar to the reduced example below. The user is instructed to choose a file, which gets read using read.csv. In this example, I just have the name of the file print out. When I call this function with choosefile(), the file dialog box appears before the first cat line is printed. After I choose a file, both cat lines are printed. choosefile
2006 Mar 22
2
Choose.files to give shortnames
Hi I am writing a script to generate a QC report for some data based on a number of files. I am currently using the choose.files function to select the files as not all the files need to be QC'd. One minor issue is that choose.files returns the complete path of the filename (eg "C:/QCdata/Test1/File01", "C:/QCdata/Test1/File02"...). Is it possible to use choose.files to