Displaying 20 results from an estimated 700 matches similar to: "RE: rmultinom"
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 Jan 27
1
rmultinom() -- how \\ via own C code?
I've had a need for multinomial "random number generation"
occasionally. And other people too.
The following code is currently in the 
(very small ``not very high importance'') CRAN package normix
 --- which I will rename to "nor1mix" very seen because of a 
    ``name registration'' problem
I want to add "this" (well the functionality) to a
2023 Apr 08
1
Error message for infinite probability parameters in rbinom() and rmultinom()
>>>>> Christophe Dutang 
>>>>>     on Sat, 8 Apr 2023 14:21:53 +0200 writes:
    > 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,
2023 Apr 08
1
Error message for infinite probability parameters in rbinom() and rmultinom()
On 08/04/2023 5:53 p.m., Martin Maechler wrote:
>>>>>> Christophe Dutang
>>>>>>      on Sat, 8 Apr 2023 14:21:53 +0200 writes:
> 
>      > 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
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,
2016 Mar 10
0
rmultinom.c error probability not sum to 1
> On 10 Mar 2016, at 21:25 , M.van_Iterson at lumc.nl wrote:
> 
> Hi all, 
> 
> I should have given a better explanation of my problem. Here it is.
> 
> I extracted from my code the bit that gives the error. Place this in a file called test.c
Aha. Missing info #1, C not R...
> 
> #include <math.h>
> #include <R.h>
> #include <Rmath.h>
>
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
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.
2006 Jan 20
3
Troubles with the function rmultinom.c of the R's Random Number Generator
Hi,
I'm simulating a Markov chain in Fortran interfaced with R-2.2.1 in order
to generate data according to a Markov Random Field called the Potts model. 
R Version: 
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    2
minor    2.1
year     2005
month    12
day      20
svn rev  36812
Each loop of my Fortran calls the function rmultinom.c
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
2016 Mar 10
3
rmultinom.c error probability not sum to 1
Hi all, 
I should have given a better explanation of my problem. Here it is.
I extracted from my code the bit that gives the error. Place this in a file called test.c
#include <math.h>
#include <R.h>
#include <Rmath.h>
#include <float.h>
#include <R_ext/Print.h>
int main(){
  double prob[3] = {0.0, 0.0, 0.0};
  double prob_tot = 0.;
  prob[0] = 0.3*dnorm(2, 0,
2016 Mar 10
0
rmultinom.c error probability not sum to 1
On 10 Mar 2016, at 12:47 , M.van_Iterson at lumc.nl wrote:
> Dear all,
> 
> I have a questions regarding using the c function rmultinom.c.
> 
> I got the following error message "rbinom: probability sum should be 1, but is 0.999264"
> 
> Which is thrown by:
> 
> if(fabs((double)(p_tot - 1.)) > 1e-7)
> MATHLIB_ERROR(_("rbinom: probability sum should
2016 Mar 10
2
rmultinom.c error probability not sum to 1
Dear all,
I have a questions regarding using the c function rmultinom.c.
I got the following error message "rbinom: probability sum should be 1, but is 0.999264"
Which is thrown by:
if(fabs((double)(p_tot - 1.)) > 1e-7)
 MATHLIB_ERROR(_("rbinom: probability sum should be 1, but is %g"),
 (double) p_tot);
I understand my probabilities do not sum to one close enough. I
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
2008 Mar 05
1
Question on "assign(paste.."
Hello,
I'm having trouble in using "assign(paste ..." command . I could create
several dataframes following trinomial distribution using it but it could
not be used to check their row means of the created dataframe.
For example, the following works:
probTrt=matrix(0,4,3);
probTrt;
#malf, death, normal
probTrt[1,]=c(0.064,0.119,0.817);#for Trt 1
probTrt[2,]=c(0.053,0.125,0.823);#for
2009 Dec 21
2
Reading multiple Input Files
Dear R helpers,
 
Suppose I am dealing with no of interest rates at a time and the no of interest rates I am selecting for my analysis is random i.e. it can be 2, can be 10 or even higher. The R-code I had written (with the guidance of R helpers obviously and I am really grateful to all of you) as of now is sort of hard coding when it comes to reading interest rates as an input e.g.
 
## INPUT
 
2011 Jun 27
1
Hardy Weinberg Simulation
Hello,
I am trying to simulate 10 relicates of 100-tables. Each table is a 2 x 3
and 80% pf the tables are true nulls and 20% are non-nulls. The nulls follow
the Hardy Weinberg distribution (ratio) 1:2:1.
I have the code below but the p-values are not what I am expecting. I want
to use the Cochran Armitage trend test to get the p-values.
num.reps=10
num.vars=1000
pi0 = 80
num.subjects = 100
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)
2006 Feb 23
0
Ruby-GetText-Package-1.2.0
Hi,
Ruby-GetText-Package-1.2.0 is now available.
Changes for RoR
---------------
 * Works with rjs templates.
 * Add methods to change the error message dialog(?) title/explanation.
 * Bugfixes. 
 * Added GetText.Nn_().
Website
-------
http://rubyforge.org/projects/gettext/
* Download
  http://rubyforge.org/frs/?group_id=855&release_id=2856
* Ruby-GetText-Package HOWTOs
 
2009 Sep 21
2
Four concurrent Markov chains
Hi,
I am trying to write a simulation of the movements of four animals between
six patches. The movement between patches is based on a first-order Markov
chain so that the next patch they visit depends on the patch they were in
before.
I have written code that allows me to simulate the movement of one animal
but when I add more there seems to be a problem and all chains come back as
N/A. I can