Displaying 20 results from an estimated 10000 matches similar to: "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
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
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
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
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
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
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
2005 May 26
1
Chi Square Test on two groups of variables
Dear R help
I have been trying to conduct a chi square test on two groups of variables
to test whether there is any relationship between the two sets of variables
chisq.test(oxygen, train)
Pearson's Chi-squared test
data: oxygen
X-squared = 26.6576, df = 128, p-value = 1
> chisq.test(oxygen)
Pearson's Chi-squared test
data: oxygen
X-squared = 26.6576, df = 128,
2010 Dec 10
0
locfit weights not working as expected
Hello! I am having a problem understanding what the weights option in
the locfit command of the locfit package is doing. I
have written a sample program which illustrates the issue (below). The
example involves using bootstrap however, that is not my main
goal but it illustrates where my problem lies.
As you know, to compute a bootstrap estimate of a particular quantity
using a sample size of
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
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
2007 Mar 05
3
Mixed effects multinomial regression and meta-analysis
R Experts:
I am conducting a meta-analysis where the effect measures to be pooled
are simple proportions. For example, consider this data from
Fleiss/Levin/Paik's Statistical methods for rates and proportions (2003,
p189) on smokers:
Study N Event P(Event)
1 86 83 0.965
2 93 90 0.968
3 136 129 0.949
4 82 70 0.854
Total
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
2010 Feb 11
1
Rounding multinomial proportions
I present you with a function that solves a problem that has bugged me for
many years. I think the problem may be general enough to at least consider
adding this function, or a revamped version of it, to the 'stats' package,
with the other multinomial functions reside.
I'm using R to export data to text files, which are input data for an
external model written in C++. Parts of the