similar to: rmultinom.c error probability not sum to 1

Displaying 20 results from an estimated 1000 matches similar to: "rmultinom.c error probability not sum to 1"

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 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> >
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
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,
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
2008 May 13
1
Catching warning message(stdout) from C
I'm using the 'pnt' C function from Rmath library in some C-code. How can I catch the warning message: "full precision was not achieved in 'pnt'" in R. I call the function using the .C(). (options(warn=-1) didn't work) Thanks in advance -- Maarten van Iterson Center for Human and Clinical Genetics Leiden University Medical Center (LUMC) Research Building,
2010 Dec 06
1
lattice: strip panel function question
Dear list, If have some repeated measurement data which looks something like: time <- rep(1:5 , each=2*4) groups <- rep(c("Case", "Control"), each=4) subjects <- factor(rep(1:(2*4), 5)) responses <- time + rnorm(5*2*4) + as.integer(factor(groups)) data <- data.frame(responses, time, groups, subjects) Now I want to plot each subject in a separate panel:
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
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
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
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
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
2014 Oct 19
2
Matrices complejas
Saludos compañeros/as. Consideren una matriz de n columnas y n filas. Quiero distribuir aleatoriamente 6 números predefinidos (11,12,13,21,22,23,31,32,33,41,42,43), con una probabilidad de aparición de cada número que será igual a la frecuencia de ese número dividida por la frecuencia total de todos los números. Soy incapaz de resolver el problema: con la función rbinom sólo puedo generar dos
2007 Aug 28
3
Forcing coefficients in lm object
Dear all, I would like to use predict.lm() with an existing lm object but with new arbitrary coefficients. I modify 'fit$coef' (see example below) "by hand" but the actual model in 'fit' used for prediction does not seem to be altered (although fit$coef is!). Can anyone please help me do this properly? Thanks in advance, J?r?mie > dat <-
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
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)
2004 Oct 14
3
is.vector() gives error (PR#7288)
Full_Name: Jelle Goeman Version: 2.0.0 OS: windows Submission from: (NULL) (145.88.209.33) I get a strange error: > is.vector(1:10) Error: recursive default argument reference What's recursive about is.vector? Kind regards, Jelle Goeman My R: platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2
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