similar to: rmultinom() -- how \\ via own C code?

Displaying 20 results from an estimated 2000 matches similar to: "rmultinom() -- how \\ via own C code?"

2002 Aug 05
0
Re: [S] Multinomial
>>>>> "Jacob" == Jacob van Wyk <jlvw at rau.ac.za> writes: Jacob> Could anybody please help: I simply want to generate Jacob> random samples from a multinomial distribution with Jacob> fixed n and given probability vector p. Jacob> How can I do this? I've recently written the following {for the R package "normix"}. The
2002 Aug 08
0
RE: rmultinom
Hi Mark: I had also used sample and tabulate for generating multinomial and found it to be quite slow. So I had written a multinomial random numbers generator based on the GENMUL subroutine from "ranlib", which in turn is based on the algorithm from Luc Devroye's book on "Non-Uniform Random Variate Generation" You may want to compare this with your hybrid algorithm and
2003 Nov 19
0
'nor1mix' for 1-dimensional normal mixture distributions
I have been authoring a very small R package on CRAN, named "normix" which implements an S3 class "norMix" has plot and print methods; further, E[X] and Var[X] methods, random number generation ("r") and density evaluation. It also provides the 16 "Marron-Wand densities" (known in the (1d) density estimation business). Erik J?rgensen has provided
2003 Nov 19
0
'nor1mix' for 1-dimensional normal mixture distributions
I have been authoring a very small R package on CRAN, named "normix" which implements an S3 class "norMix" has plot and print methods; further, E[X] and Var[X] methods, random number generation ("r") and density evaluation. It also provides the 16 "Marron-Wand densities" (known in the (1d) density estimation business). Erik J?rgensen has provided
2002 Aug 08
0
RE: rmultinom
Dear newsgroup, There was a recent post suggesting the incorporation of a standard rmultinom(...). This seems like a good idea, but I wasn't sure about basing this on tabulate( sample( ...)). Despite the attractive succinctness, this could be very slow and use lots of memory if n or size is large. Instead, I've tended to use a loop over the boxes of the multinomial, taking successive
2006 May 09
1
combn(n, k, ...) and all its re-inventions
It seems people are reinventing the wheel here: The goal is to generate all combinations of 1:n of size k. This (typically) results in a matrix of size k * choose(n,k) i.e. needs O(n ^ k) space, hence is only applicable to relatively small k. Then alternatives have been devised to generate the combinations "one by one", and I think I remember there has been a quiz/challenge about 20
2003 Jul 17
3
univariate normal mixtures
Hello, I have a concrete statistical question: I have a sample of an univariate mixture of an unknown number (k) of normal distributions, each time with an unknown mean `m_i' and a standard deviation `k * m_i', where k is known factor constant for all the normal distributions. (The `i' is a subscript.) Is there a function in R that can estimate the number of normal distributions k
2007 Apr 22
0
rmultinom
Hi Can anyone help me? I am not an experienced R user (or statistician!). If I use rmultinom to generate random outcomes of a multinomial distribution, how do i use these in a way to help conduct an exact chi-squared test? woozles48 -- View this message in context: http://www.nabble.com/rmultinom-tf3626954.html#a10127600 Sent from the R help mailing list archive at Nabble.com.
2004 Sep 05
1
Biased calculations from using rmultinom?
Dear R users, This is a problem that has puzzled me for quite some time, and I wonder if anyone could offer me an insight to what is happening? I generated a multinomial matrix by using A<-rmultinom(100,1,c(0.4,0.3,0.2,0.1), and multiply this matrix by a set of values say B<-runif(n,100,50). I then calculate var(colSums(A*B)). I was able to work out the theoretical mean of
2007 Mar 30
1
faster computation of cumulative multinomial distribution
Dear list members, I have a series of /unequal/ probabilities [p1,p2,...,pk], describing mutually exclusive events, and a "remainder" class with a probability p0=1-p1-p2-....-pk, and need to calculate, for a given number of trials t>=k, the combined probability that each of the classes 1...k contains at least 1 "event" (the remainder class may be empty). To me this reaks
2003 Apr 24
1
estimating number of clusters ("Null or more")
Hi all, once more about the old subj :-) My data has too much various distribution families and for every particular experiment I need just to decide whether the data is "quite homogeneous" or it has two or more clusters. I've revisited the following libraries: amap, clust, cclust, mclust, multiv, normix, survey. And I didn't find any ready-to-use general
2003 Apr 10
6
How to plot several graphs in a single 2-D figure?
Hi, R-listers I tried to plot several graphs in a sigle x-y coordinate settings, like the following: |(y) s | ****** s | ***** s | sssssssssssssssssss |_______________________________(x) where "*" and "s" denote two diffrent plots. However, when I used plot(data1); % data1 is the data points of "*"
2011 Apr 04
1
Difference in mixture normals and one density
Hello, I am trying to find out if R can do the following: I have a mixture of normals say f = 0.2*Normal(2, 5) + 0.8*Normal(3,2) How do I find the difference in the densities at any particular point of f and at Normal(2,5)? -- Thanks, Jim. [[alternative HTML version deleted]]
2016 Jan 27
2
Bootstrap data frame (Jesús Para Fernández)
Hola Jesús, Si no entiendo mal lo que planteas, has observado unas frecuencias N = c(12, 0, 8, 6, 4, 2) de pedidos acaecidos en 1:6 días, en total n = sum(N) pedidos. Llamemos P = (p1, p2, ?, p6) a las probabilidades ?teóricas? de pedido en cada día. En principio el vector N se puede considerar una realización de una distribución multinomial M(n; p1, ?, p6). P se puede estimar mediante las
2005 Oct 03
6
sampling vectors
Hello Listers, I am trying to sample a vector to create a new one of sample length, witha sum equal to the sum of the initial vector: initial = 10, 30, 10 (sum=50) sample example = 5, 35, 10 (sum=50) or 25, 15, 10 (sum=50), etc ... My problem is to control the sum, so it stays constant. Any suggestions would be very helpful ! Thank you in advance, Eric
2008 Jan 17
1
'simulate.p.value' for goodness of fit
R Help on 'chisq.test' states that "if 'simulate.p.value' is 'TRUE', the p-value is computed by Monte Carlo simulation with 'B' replicates. In the contingency table case this is done by random sampling from the set of all contingency tables with given marginals, and works only if the marginals are positive... In the
2023 Apr 08
1
Error message for infinite probability parameters in rbinom() and rmultinom()
Dear all, Using rmultinom() in a stochastic model, I found this function returns an error message 'NA in probability' for an infinite probability. Maybe, a more precise message will be helpful when debugging. > rmultinom(1, 3:5, c(1/2, 1/3, Inf)) Error in rmultinom(1, 3:5, c(1/2, 1/3, Inf)) : NA in probability vector > rmultinom(1, 3:5, c(1/2, 1/3, NA)) Error in rmultinom(1,
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
2010 Sep 08
11
problem with outer
Hello, i wrote this function guete and now i want to plot it: but i get this error message. i hope someone can help me. Error in dim(robj) <- c(dX, dY) : dims [product 16] do not match the length of object [1] p_11=seq(0,0.3,0.1) p_12=seq(0.1,0.4,0.1) guete = function(p_11,p_12) { set.seed(1000) S_vek=matrix(0,nrow=N,ncol=1) for(i in 1:N) { X_0=rmultinom(q-1,size=1,prob=p_0)
2011 Apr 15
1
How to generate a correlation matrix with restrictions on its eigenvalues
Dear All, I would like to generate m positive real numbers c_i, I=1,...,m, such that (1) c_1 + c_2 + ... + c_m=m, (1) after being ordered into c_1 >= c_2 >= .... >=c_m>0, we have that c_m is of the same order of m^(-1/8), when m is sufficiently large. Thanks, -Chee [[alternative HTML version deleted]]