search for: dbinom

Displaying 20 results from an estimated 120 matches for "dbinom".

2007 Apr 05
1
binom.test() query
...nvestigate further) led me to take a close look at the code for binom.test(). I now have a query! The code for the two-sided case computes the p-value as follows: if (p == 0) (x == 0) else if (p == 1) (x == n) else { relErr <- 1 + 1e-07 d <- dbinom(x, n, p) m <- n * p if (x == m) 1 else ## PVAL if x < m if (x < m) { i <- seq(from = ceiling(m), to = n) y <- sum(dbinom(i, n, p) <= d * relErr) ## here: pbinom(x,n,p) + pbinom(n-y,n,p,lower=FA...
2005 Jun 19
1
practical help ... solving a system...
Hello, I want to estimate the parameters of a binomial distributed rv using MLE. Other distributions will follow. The equation system to solve is not very complex, but I've never done such work in R and don't have any idea how to start... The system is: (1) n*P = X (2) [sum {from j=0 to J-1} Y{j} /(n-j)] = -n * ln (1-X / n) where * only X is given (empirical mean)
2007 Apr 06
1
dbinom and Catherine Loader
Hi Folks, There has been past correspondence regarding Catherine Loader's Bell Labs (oops, Lucent) paper "Fast and Accurate Computation of Binomial Probabilities" which gives the algorithm on which R's dbinom() is based. The original URL given in the R documentation "?dbinom" is: http://cm.bell-labs.com/cm/ms/departments/sia/catherine/dbinom but this link is dead. Likewise, Marc Schwarz (in reply to Aries Arditi on Thu Dec 11 2003) gives http://kiefer.stat.cwru.edu/~catherine/pubs.html...
2009 Apr 17
5
Binomial simulation
Hi Guy's I was wondering if someone could point me in the right direction. dbinom(10,1,0.25) I am using dbinom(10,1,0.25) to calculate the probabilty of 10 judges choosing a certain brand x times. I was wondering how I would go about simulating 1000 trials of each x value ? regards Brendan -- View this message in context: http://www.nabble.com/Binomial-simulation-tp2310634...
2013 Mar 10
0
max row
...pply(0:m1,function(x1) >>>>do.call(rbind,lapply(0:n1,function(y1) >>>>expand.grid(m1,n1,x1,y1)))))))))? >>>>names(d)<-c("m1","n1","x1","y1") >>>> >>>>d<-within(d,{ >>>>term1_p1<- dbinom(x1,m1, p1L, log=FALSE)* dbinom(y1,n1,p1H, log=FALSE) >>>>term1_p0<- dbinom(x1,m1, p0L, log=FALSE)* dbinom(y1,n1,p0H, log=FALSE) >>>>}) ? ? ? >>>> >>>>########## add Qm Qn ################################## >>>>set.seed(8) >>>&g...
2005 Apr 13
1
i param in "for" loop does not takes zeros?
Hi all Is there any reason why the parameter i in a "for" loop ignores a value of zero? For example sim=c() p=.2 for(i in 0:5) {sim[i]=dbinom(i,5,p) } sim [1] 0.40960 0.20480 0.05120 0.00640 0.00032 In this example the quantile i= 0 was ignored since dbinom(0,5,p) [1] 0.32768 The same behaviour occurs if I use a while loop to perform the same calculation: sim=c() p=.2 i=0 while(i <6) {sim[i]=dbinom(i,5,p) i=i+1 } sim [1]...
2006 Mar 22
4
pbinom( ) function (PR#8700)
Full_Name: Chanseok Park Version: R 2.2.1 OS: RedHat EL4 Submission from: (NULL) (130.127.112.89) pbinom(any negative value, size, prob) should be zero. But I got the following results. I mean, if a negative value is close to zero, then pbinom() calculate pbinom(0, size, prob). dbinom() also behaves similarly. > pbinom( -2.220446e-22, 3,.1) [1] 0.729 > pbinom( -2.220446e-8, 3,.1) [1] 0.729 > pbinom( -2.220446e-7, 3,.1) [1] 0
2020 May 18
3
dbinom link
...and that the author has > significant published works which are open access, I'd be surprised if > there's any objection to reproducing it. > > > On Mon, May 18, 2020 at 8:01 PM Koenker, Roger W <rkoenker at illinois.edu> wrote: >> >> FWIW the link from ?dbinom to the Loader paper on Binomials is broken but the paper seems to be >> available here: https://octave.1599824.n4.nabble.com/attachment/3829107/0/loader2000Fast.pdf >> >> Roger Koenker >> r.koenker at ucl.ac.uk<mailto:r.koenker at ucl.ac.uk> >> Honorary Profes...
2020 May 18
2
dbinom link
FWIW the link from ?dbinom to the Loader paper on Binomials is broken but the paper seems to be available here: https://octave.1599824.n4.nabble.com/attachment/3829107/0/loader2000Fast.pdf Roger Koenker r.koenker at ucl.ac.uk<mailto:r.koenker at ucl.ac.uk> Honorary Professor of Economics Department of Economics, UCL...
2020 May 18
0
dbinom link
What about using the Wayback Machine archive ? The web archive should be more stable than other links which also might disappear in the future. E.g. https://web.archive.org/web/20070610002602/http://www.herine.net/stat/software/dbinom.html , which also links to an archived copy of the PDF. Best regards, Hilmar On 18.05.20 10:57, peter dalgaard wrote: > In principle a good idea, but I'm not sure the whereabouts of Catherine Loader are known at this point. Last peeps from her on the net seem to be about a decade old. &g...
2011 Jan 27
1
binomial dist: obtaining probability of success on each trial
I'm trying to fathom how to answer two example problems (3.3.2 & 3.3.3) in: Krishnamoorthy. 2006. "handbook of statistical distributions with applications" The first requires calculating single trial probability of success for a binomial distribution when we know: trial size=20, successes k=4, P(x<=k)=0.7 Appreciably all the binomial functions are requiring "prob",
2020 May 18
0
dbinom link
...t restrictions on reproducing it), and that the author has significant published works which are open access, I'd be surprised if there's any objection to reproducing it. On Mon, May 18, 2020 at 8:01 PM Koenker, Roger W <rkoenker at illinois.edu> wrote: > > FWIW the link from ?dbinom to the Loader paper on Binomials is broken but the paper seems to be > available here: https://octave.1599824.n4.nabble.com/attachment/3829107/0/loader2000Fast.pdf > > Roger Koenker > r.koenker at ucl.ac.uk<mailto:r.koenker at ucl.ac.uk> > Honorary Professor of Economics >...
2010 Feb 21
1
how do I get the legend?
...density plot in that http://en.wikipedia.org/wiki/File:Binomial_distribution_pmf.svg wiki page ? and the cumalative plot as well? ==================================== # Binomial Distribution x=0:40 plot(sin,ylim=c(0,.20),xlim=c(0,40),type='n',xlab="n",ylab="") points(dbinom(x,20,0.5)) points(dbinom(x,20,0.7),col=2) points(dbinom(x,40,0.5),col=3) ==================================== Thanks. -- View this message in context: http://n4.nabble.com/how-do-I-get-the-legend-tp1563309p1563309.html Sent from the R help mailing list archive at Nabble.com.
2009 Feb 05
1
Incorrect p value for binom.test?
...ook and SAS both show 2*9.94e-07 = 1.988e-06 as the two tailed value. As does the R summation syntax from R below. It looks to me like the alternative hypothesis language should be revised to something like " ... greater than or equal to ..." Am I mistaken? M.C.Grant > 2*sum(dbinom(c(10:25),25,0.061)) [1] 1.987976e-06 > binom.test(10,25,0.061) Exact binomial test data: 10 and 25 number of successes = 10, number of trials = 25, p-value = 9.94e-07 alternative hypothesis: true probability of success is not equal to 0.061 95 percent confidence interv...
2011 Mar 19
2
problem running a function
...+ lik<-function(parms){ + r<-expit(parms[1]) + lambda<-exp(parms[2]) + pvec<-1-(1-r)^(0:Nmax) + gN<-dpois(0:Nmax,lambda) + gN<-gN/sum(gN) + lik<-rep(NA,nsites) + for(i in 1:nsites){ + lik[i]<-sum(dbinom(y[i],J,pvec)*gN) + } + -1*sum(log(lik)) + } + #### + + tmp<-nlm(lik,c(0,0),hessian=TRUE) + ests<-tmp$estimate + aic<-tmp$minimum*2 + 2*length(ests) + se<- sqrt(diag(solve(tmp$hessian))) + list(ests=ests,se=se,aic=aic) + } but when I try to see t...
2009 Jan 05
2
Sweave data-figure coupling
...ollowing Sweave minimal file: ---<--------------------cut here---------------start------------------->--- \documentclass{article} \usepackage{Sweave} \begin{document} <<binom-sim>>= thetas <- seq(0, 1, by=0.001) prior <- rep(1, length(thetas)) / length(thetas) lik <- dbinom(1, 1, thetas) lik.p <- prior * lik post <- lik.p / sum(lik.p) <<binom-sim-fig, fig=TRUE, include=FALSE, height=3, echo=FALSE>>= layout(matrix(1:2, ncol=2)); par(mar=c(5, 4, 2, 1), cex=0.75) matplot(thetas, cbind(prior, lik, post), type="l", lty=c(2, 1, 1), xlab=...
2004 Aug 10
0
Check failed after compilation (PR#7159)
...0.50 0.55 0.60 0.65 0.70 [16] 0.75 0.80 0.85 0.90 0.95 1.00 > > > > cleanEx(); ..nameEx <- "Binomial" > > ### * Binomial > > flush(stderr()); flush(stdout()) > > ### Name: Binomial > ### Title: The Binomial Distribution > ### Aliases: Binomial dbinom pbinom qbinom rbinom > ### Keywords: distribution > > ### ** Examples > > # Compute P(45 < X < 55) for X Binomial(100,0.5) > sum(dbinom(46:54, 100, 0.5)) [1] 0.6317984 > > ## Using "log = TRUE" for an extended range : > n <- 2000 > k <- seq(0,...
2013 Feb 01
29
cumulative sum by group and under some criteria
Thank you very much for your reply. Your code work well with this example. I modified a little to fit my real data, I got an error massage. Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) : Group length is 0 but data length > 0 On Thu, Jan 31, 2013 at 12:21 PM, arun kirshna [via R] < ml-node+s789695n4657196h87@n4.nabble.com> wrote: > Hi, > Try this: >
2008 Sep 29
4
histogram-like plot with two variables
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080929/e8ff7cb6/attachment.pl>
2012 Apr 19
1
non-numeric argument in mle2
Hi all, I have some problems with the mle2 function > RogersIIbinom <- function(N0,attackR3_B,Th3_B) {N0-lambertW(attackR3_B*Th3_B*N0*exp(-attackR3_B*(24-Th3_B*N0)))/(attackR3_B*Th3_B)} > RogersII_B <- mle2(FR~dbinom(size=N0,prob=RogersIIbinom(N0,attackR3_B,Th3_B)/N0),start=list(attackR3_B=1.5,Th3_B=0.04),method="Nelder-Mead",data=dat) Error in dbinom(x, size, prob, log) : Non-numeric argument to mathematical function Can somenone explain met what this error means? All my parameters and data are...