Hi All: I am trying to generate Beta-Binomial data with regressors using R. I have used the following code to generate Beta-Binomial data. Now I want to add a covariate to the equation. I would then like to use the simulated data to run the Beta-Binomial model with covariates on it. Appreciate any help. set.seed(111) k<-20 n<-60 x<-NULL p<-rbeta(k,3,3)# so that the mean nausea rate is alpha/(alpha+beta) for(i in 1:k) x<-cbind(x,rbinom(300,n,p[i])) Thanks Anamika [[alternative HTML version deleted]]
Hello, Isn't the same question posted on stackoverflow (http://stackoverflow.com/questions/11705062/generating-beta-binomial-responses-with-covariates)?? I guess you got the answer there. In general, cross-posting is not that preferred in R. A.K. ----- Original Message ----- From: Anamika Chaudhuri <canamika at gmail.com> To: r-help at r-project.org Cc: Sent: Saturday, July 28, 2012 6:28 PM Subject: [R] Beta-Binomial Regression in R Hi All: I am trying to generate Beta-Binomial data with regressors using R. I have used the following code to generate Beta-Binomial data.? Now I want to add a covariate to the equation. I would then like to use the simulated data to run the Beta-Binomial model with covariates on it. Appreciate any help. set.seed(111) k<-20 n<-60 x<-NULL p<-rbeta(k,3,3)# so that the mean nausea rate is alpha/(alpha+beta) for(i in 1:k) x<-cbind(x,rbinom(300,n,p[i])) Thanks Anamika ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
On Jul 28, 2012, at 3:28 PM, Anamika Chaudhuri wrote:> Hi All: > > I am trying to generate Beta-Binomial data with regressors using R. > I have > used the following code to generate Beta-Binomial data. Now I want > to add > a covariate to the equation. I would then like to use the simulated > data to > run the Beta-Binomial model with covariates on it. Appreciate any > help. > > set.seed(111) > k<-20 > n<-60 > x<-NULL > > p<-rbeta(k,3,3)# so that the mean nausea rate is alpha/(alpha+beta) > for(i in 1:k) > x<-cbind(x,rbinom(300,n,p[i]))Cross-posting to Rhelp and SO (at least on on the same day) is deprecated by the Rhelp Posting Guide.> > Thanks > Anamika > > [[alternative HTML version deleted]]> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html-- David Winsemius, MD Alameda, CA, USA