user734124
user734124

Reputation: 499

modeling a beta-binomial regression

Assume this easy example:

treatment <- factor(rep(c(1, 2), c(43, 41)), levels = c(1, 2),labels = c("placebo", "treated"))
improved <- factor(rep(c(1, 2, 3, 1, 2, 3), c(29, 7, 7, 13, 7, 21)),levels = c(1, 2, 3),labels = >c("none", "some", "marked"))
numberofdrugs<-rpois(84, 50)+1
healthvalue<-rpois(84,5)
y<-data.frame(healthvalue,numberofdrugs, treatment, improved)
test<-lm(healthvalue~numberofdrugs+treatment+improved, y)

What am I supossed to do when I'd like to estimate a beta-binomial regression with R? Is anybody familiar with it? Any thought is appreciated!

Upvotes: 1

Views: 2702

Answers (1)

Ben Bolker
Ben Bolker

Reputation: 226172

I don't see how this example relates to beta-binomial regression (i.e., you have generated count data, rather than (number out of total possible)). To simulate beta-binomial data, see rbetabinom in either the emdbook or the rmutil packages ...

library(sos); findFn("beta-binomial") finds a number of useful starting points, including

  • aod (analysis of overdispersed data), betabin function
  • betabinomial family in VGAM
  • hglm package
  • emdbook package (for dbetabinom) plus mle2 package

Upvotes: 3

Related Questions