Re: [R] generate multiple probability distributions

2013-12-02 Thread Michael Friendly
On 12/2/2013 10:12 AM, Duncan Murdoch wrote: dbinom can take vector inputs for the parameters, so this would be a bit simpler: x <- seq(0,12) x <- rep(x, 4) p <- rep(c(1/6, 1/3, 1/2, 2/3), each=13) bin.df <- data.frame(x, prob = dbinom(x, 12, p), p) Thanks, Duncan What I was missing was how

Re: [R] generate multiple probability distributions

2013-12-02 Thread David Carlson
... $ p : Factor w/ 4 levels "1/6","1/3","1/2",..: 1 1 1 1 1 1 1 1 1 1 ... > all.equal(bin.df, bin.df.2) [1] TRUE - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original

Re: [R] generate multiple probability distributions

2013-12-02 Thread Duncan Murdoch
On 02/12/2013 9:47 AM, Michael Friendly wrote: I want to generate a collection of probability distributions in a data frame, with varying parameters. There must be some simpler way than what I have below (avoiding rbind and cbind), but I can't quite see it. x <- seq(0,12) bin.df <- as.data.fram

[R] generate multiple probability distributions

2013-12-02 Thread Michael Friendly
I want to generate a collection of probability distributions in a data frame, with varying parameters. There must be some simpler way than what I have below (avoiding rbind and cbind), but I can't quite see it. x <- seq(0,12) bin.df <- as.data.frame( rbind( cbind(x, prob=dbinom(x,12,1/6), p