similar to: efficiency of sample() with prob.

Displaying 20 results from an estimated 10000 matches similar to: "efficiency of sample() with prob."

2004 Sep 24
1
algorithm reference for sample()
Hi, Don't know if it belongs to r-devel or r-help, but since I am planning to alter some of R's internal code I am sending it here. The existing implementation of the sample() function, when the optional 'prob' argument is given, is quite inefficient. The complexity is O(sampleSize * universeSize), see ProbSampleReplace() and ProbSampleNoReplace() in random.c. This makes the
2004 Sep 24
1
algorithm reference for sample() - Knuth
Thank you for the reference to Knuth. Indeed in vol. 2 he has a > -----Original Message----- > From: Tony Plate [mailto:tplate@blackmesacapital.com] > Sent: Friday, September 24, 2004 8:05 AM > To: Vadim Ogranovich > Subject: Re: [Rd] algorithm reference for sample() > > Have you tried looking in Knuth's books on computer > algorithms? (They are classics for good
2019 Mar 03
2
bug: sample( x, size, replace = TRUE, prob= skewed.probs) produces uniform sample
When `length( skewed.probs ) > 200' uniform samples are generated in R-devel. R-3.5.1 behaves as expected. `epsilon` can be a lot bigger than illustrated and still the uniform distribution is produced. Chuck > set.seed(123) > > epsilon <- 1e-10 > > ## uniform to 200 then small > p200 <- prop.table( rep( c(1, epsilon), c(200, 999-200))) > ## uniform to 201
2003 Apr 20
1
covariance = diagonal + F'F
Dear R-Helpers, I have a n*m data matrix (n is the number of observations) and I want to estimate its covariance matrix as a sum of a diagonal matrix and a low-rank matrix F'F, where F is p*m matrix (sometimes called "factors"), p<<m, and F' is F transpose. My questions are: 1. Given the number of factors p is there an R function that finds the best F? 2. How to select
2007 Sep 23
2
return(x=x,y=y,prob=prob) hasn't been used in R now?
Dear friends, Now, when i use the argument return(x=x,y=y,prob=prob) , R displays the waring message: Warning message: The return value for multiple variables wasn't used in: return(x = x, y = gy, prob = prob) I used the methods of "help.search("return")" and "?return" to get some help, but didn't find info on it. Anybody knows how it should be used
2003 Oct 16
1
Improving efficiency in "outer"-like calculation
Hello, I am doing mcmc=10000 simulations from a posterior distribution of the parameters of a mixture of K=6 normal densities. I have mcmc by K matrices simMeans, simVars and simWeights containing the simulation output: one row for each simulation, one column for each normal component of the mixture. One thing I would like to do is a plot of the posterior predictive density. In order to do that
2008 Jan 10
0
prob package: elementary probability on finite sample spaces
Dear R Community, I am pleased to announce the beta-release of the prob package. The source code is now on CRAN, and binaries should be generated there before long. In the meantime, you can get it with install.packages("prob", repos = "http://r-forge.r-project.org") The prob package gives a framework for doing elementary probability on finite sample spaces in R. The
2008 Jan 10
0
prob package: elementary probability on finite sample spaces
Dear R Community, I am pleased to announce the beta-release of the prob package. The source code is now on CRAN, and binaries should be generated there before long. In the meantime, you can get it with install.packages("prob", repos = "http://r-forge.r-project.org") The prob package gives a framework for doing elementary probability on finite sample spaces in R. The
2017 Nov 01
2
"prob" package alternative
The prob package has been archived because it depends upon some other packages which have issues. However, such projects as Introduction to Probability and Statistics in R depend upon it for learning. There are a few other resources that also use it. Does anyone know of any workarounds? Someone at stack exchange mentioned using R 2.9. However, that broke my RStudio (WSOD) and the dependent
2000 May 12
1
Geometric Distribution at prob=c(0,1)
Dear all, I''m working with the geometric distribution for the time being, and I''m confused. This may have more to do with statistics than R itself, but since I''m getting results from R I find counterintuitive (well, yeah, my statistical intuition has not been properly sharpened), I feel like asking. The point first: If I do > rgeom(1,prob=1) I get: [1] NaN Warning
2006 Jun 16
0
prob in sample function
Hi, I have a data set with values (L) varying from 1 to 700, with repeated numbers, and I want to sample them according to the probabilities given by a logistic curve P=1/(1+e(-r*(L-Lc))) where r gives "S" the inclination and Lc the "rotation point". P ranges from 0 to 1. As I could see I cannot use this P as prob in sample function. I'd need the probabilities as given by
2009 Mar 28
1
Error in R??
Can someone explain why I am getting the following error: in the r code below? Error in solve.default(diag(2) + ((1/currvar) * (XX1 %*% t(XX1)))) : system is computationally singular: reciprocal condition number = 0 In addition: There were 50 or more warnings (use warnings() to see the first 50) The R code is part of a bigger program. ##sample from full conditional
2017 Nov 01
0
"prob" package alternative
> On Nov 1, 2017, at 12:51 PM, Tiby Kantrowitz <tlkantro at gmail.com> wrote: > > The prob package has been archived because it depends upon some other > packages which have issues. > > However, such projects as Introduction to Probability and Statistics in R > depend upon it for learning. There are a few other resources that also use > it. > > Does anyone
2007 Jan 05
1
Efficient multinom probs
Dear R-helpers, I need to compute probabilties of multinomial observations, eg by doing the following: y=sample(1:3,15,1) prob=matrix(runif(45),15) prob=prob/rowSums(prob) diag(prob[,y]) However, my question is whether this is the most efficient way to do this. In the call prob[,y] a whole matrix is computed which seems a bit of a waste. Is there maybe a vectorized version of dmultinom which
2006 Dec 09
1
Error in rmultinom(n, size, prob) : too few positive probabilities
// R 2.3.1 Can someone please explain why this error returns? > y=numeric(100) > x=matrix(runif(16),4,4) > for(i in 2:100) + { + y[i]=which(rmultinom(1, size = 1, prob = x[y[i-1], ])==1) + } Error in rmultinom(n, size, prob) : too few positive probabilities thx much ej
2008 Jun 04
1
permsn incorrect when x==m (library: prob) (PR#11571)
Full_Name: Obnoxious Version: 2.7.0 OS: Windows Submission from: (NULL) (121.223.77.238) Objective: Generate all permutations of the elements of x taken m at a time. Library: prob Function: permsn Issue: Does not appear to be working correctly when x==m. Example: libary(prob) permsn(2,1) i.e., x > m #Gives the correct result of [,1] [,2] [1,] 1 2 #Yet permsn(2,2) i.e., x==m
2017 Nov 02
0
"prob" package alternative
> On Nov 2, 2017, at 11:15 AM, Tiby Kantrowitz <tlkantro at gmail.com> wrote: > > The issue is fAsianOptions. Is there a version that works with the latest version of R? If not, which version of it works with which version of R and where can it be found? I tried several at the archive already. sessionInfo() R version 3.4.2 Patched (2017-10-04 r73465) Platform:
2023 Apr 06
1
"prob" package alternative
>>>>> peter murage >>>>> on Tue, 4 Apr 2023 06:24:56 +0000 writes: > Which package in R replaced package prob? Well, if you google that you should quickly be lead to (something I even think makes sense to memorize as "rule" package=<pkg> ) : https://CRAN.R-project.org/package=prob which now says that the package was archived as it
2017 Nov 02
2
"prob" package alternative
The issue is fAsianOptions. Is there a version that works with the latest version of R? If not, which version of it works with which version of R and where can it be found? I tried several at the archive already. Alternatively, is there another package that behaves similarly to prob? On Wed, Nov 1, 2017 at 6:17 PM, David Winsemius <dwinsemius at comcast.net> wrote: > > > On Nov
2017 Nov 02
0
"prob" package alternative
> On Nov 2, 2017, at 12:07 PM, Tiby Kantrowitz <tlkantro at gmail.com> wrote: > > Yes. That's the version I've been discussing that has non-zero exit status. That situation is why CRAN retired the prob package. It's possible you installed that library earlier in development and it's been "carried" along. It no longer installs, now. > > The problems