[R] Beta-Binomial Regression in R

David Winsemius dwinsemius at comcast.net
Sun Jul 29 09:04:51 CEST 2012


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



More information about the R-help mailing list