search for: dmultinom

Displaying 10 results from an estimated 10 matches for "dmultinom".

Did you mean: multinom
2009 Nov 04
1
compute maximum likelihood estimator for a multinomial function
...Bolker "Ecological models and data in R", chapter 6: "Likelihood an all that". But he has no example for multinomial functions. What I did is the following: I first defined a function for the negative log likelihood: ####################### log.multi<-function(d,p){ -sum(dmultinom(d,prob=p,log=T)) } ##then defined the parameters d<-data ## (in my case counts of animals found dead in different age-classes 1:19) p<-d/sum(d) ##or some values close to the analytical solution n(i)/N for the probabilities ##then I used the optim function like this: opt1<-optim(par=...
2007 Jan 05
1
Efficient multinom probs
...oing 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 does this? Best, Ingmar
2010 Nov 18
1
dmultinomial
Hello All, I'm trying to run a maximum likelihood analysis using dmultinomial (i'm avoiding dmultinom as I'd like to run it with vectors for the ML stuff). However, I'm having a hard time getting even the simplest example running. Any help would be greatly appreciated. > library(mc2d) > dmultinomial(x=c(0,0,1),prob=c(1,1,1),size=1,log=TRUE) Error in i...
2011 Jul 24
0
2 x 3 table
...orrect R code for the following table? Row totals are fixed at 100 each (case control situation). aa Aa AA Total 10 20 70 100 20 40 50 100 30 60 120 So the row totals are fixed. Is this the correct code3? Likelihood.ratio = dmulitnom(100, c(0.1, 0.2, 0.7))*dmultinom(100, c(0.2, 0.4, 0.5)) divided by dmulitnom(100, c(0.33, 0.33, 0.34))*dmultinom(100, c(0.33, 0.33, 0.34)) What about if the null came from the HWE proportions how will this work for the case control SNP situation? -- Thanks, Jim. [[alternative HTML version deleted]]
2007 Mar 30
1
faster computation of cumulative multinomial distribution
...ular case I may use reciprocal probabilities, and if I do this I get an equation with "only" 2^k terms, which would shorten my computations to a few decades. Isn't there a faster (numerical approximation?) way to do this? R has dbinom /and/ pbinom functions, but unfortunately only a dmultinom and no pmultinom function... perhaps because there is no (known) faster way? with kind regards, Theo Borm
2010 Feb 12
1
using mle2 for multinomial model optimization
...#harvest rate l<-length(d) p<-rep(0,l) #Cell probabilities p[1]<-h[1] prod<-(1-h[1])*S[1] for (i in 2:(l-1)){ p[i]<-prod*h[i] prod<-prod*(1-h[i])*S[i] } p[l]<-1-sum(p[-l]) #last cell probability -dmultinom(exp(d),prob=p,log=TRUE) #exp(d)->backtransform the estimates } c<-c(cohort,100) #untransformed initial values for the optimization,->100=N-x1-x2-x3 nvec<-c(rep("x",l-1),"N") #names for the initial vector nrs<-c(1:(l-1),1) #nrs for th...
2013 Dec 10
1
fisher.test - can I use non-integer expected values?
I seem to be able to use expected values that are decimal (e.g., 1.33) when using chisq.test but not when using fisher.test. This happens when using an array/matrix as input. Fisher.test returns: Error in sprintf(gettext(fmt, domain = domain), ...) : invalid format '%d'; use format %s for character objects. Thus, it appears fisher.test is looking for integers only. I tried putting the
2003 Apr 16
2
R-1.7.0 is released
...ntrality parameter `ncp', and there's a C API for rnchisq(). o New generic function reorder() with a dendrogram method; new order.dendrogram() and heatmap(). o require() has a new argument, character.only, -- to make it align with library. o New functions rmultinom() and dmultinom(), the first one with a C API. o New function runmed() for fast runnning medians (`modreg' package). o New function slice.index() for identifying indexes with respect to slices of an array. o solve.default(a) now gives the dimnames one would expect. o stepfun() has a new `...
2003 Apr 16
2
R-1.7.0 is released
...ntrality parameter `ncp', and there's a C API for rnchisq(). o New generic function reorder() with a dendrogram method; new order.dendrogram() and heatmap(). o require() has a new argument, character.only, -- to make it align with library. o New functions rmultinom() and dmultinom(), the first one with a C API. o New function runmed() for fast runnning medians (`modreg' package). o New function slice.index() for identifying indexes with respect to slices of an array. o solve.default(a) now gives the dimnames one would expect. o stepfun() has a new `...
2003 Apr 24
2
R-1.7.0 build feedback: NetBSD 1.6 (PR#2837)
R-1.7.0 built on NetBSD 1.6, but the validation test suite failed: Machinetype: Intel Pentium III (600 MHz); NetBSD 1.6 (GENERIC) Remote gcc version: gcc (GCC) 3.2.2 Remote g++ version: g++ (GCC) 3.2.2 Configure environment: CC=gcc CXX=g++ LDFLAGS=-Wl,-rpath,/usr/local/lib make[5]: Entering directory `/local/build/R-1.7.0/src/library' >>> Building/Updating