[R] Fwd: betabinomial model

From: Zaihra T <zaihra_at_uwindsor.ca>
Date: Wed, 19 Mar 2008 12:52:38 -0400


   can anyone help me fit betabinomial model to the following dataset where    each iD is a cluster in itself , if i use package aod 's betabinom model it    gives an estimate of zero to phi(the correlation coeficient ) and if i fix    it to the anova type estimate obtained from icc( in package aod) then it    says system is exactly singular. And when i try to fit my loglikelihood by    writing a function directly for loglikelihood and try to optimise using    optim it gives warnings as well as error and if i use NLMINB then    convergence is false.

   Can someone save my soul..... pl!!!!!!!!z below is my program script    ..............

#ovarian cancer data and parity among 769 probands and their mothers

#cancer in proband

   y1<-c(1,1,1,1,1,1,1,rep(1,29),rep(1,36),rep(1,41),r!    ep(1,85),rep(1,105),rep(1,84),


#cancer in mother

   y2<-c(1,1,1,1,1,1,1,rep(0,29),rep(0,36),rep(0,41),rep(0,85),rep(0,105),rep(0    ,84),


# total events in each cluster





# number of childbirths in mother (0 for 1-2,1 for 3+)

   z1<-c(0,0,1,1,1,1,1,rep(0,29),rep(0,36),rep(0,41),rep(1,85),rep(1,105),rep(1    ,84),


# of child births in mother three catag 2 dummy variables z2=1(1-2) else
   0,z3=1(o birth)else0so if z2

# z3 both r zero its 3 births catageroy

   z2<-c(0,1,0,0,0,1,0,rep(0,29),rep(1,36),rep(0,41),rep(0,85),rep(1,105),rep(0    ,84),



   1,r ep(1,22),rep(0,33),rep(0,38),rep(1,50),rep(0,103),rep(0,135))



# fitting betabinomial model accounting for icc-----------------

   beta.binomial<- betabin(cbind(y, n - y) ~ z1 +z2+z3, ~ 1, data =cancer)


# calculating ICC using REML/ML method-------------





#loglikelihood function for ordinary betabinomial model------------











   for(i in 1:n1)


   for (j in 0:y[i]-1)



#a1<-a1+log(ifelse(y[i]-1<0 ||p[i]+rho*q*j<=0,1,p[i]+rho*q*j! ))



   for(i in 1:n1)


   for (j in 0:1-y[i])



#a2<-a2+log(ifelse(1-y[i]<0 ||1+rho*q*j<=0 ,1,1+rho*q*j))








   betabinom<- optim(c(-1.2628,-0.0936,0.3485,0.6155,-.2918),b.bin, method =    "BFGS")    betabinom<-nlminb(start=c(-1.2628,-0.0936,0.3485,0.6155,-.2918),b.bin)


   beta.binomial<- betabin(cbind(y, n - y) ~ z1 +z2+z3, ~ 1, data    =cancer,fixpar=list(5,-.2918))


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. Received on Wed 19 Mar 2008 - 16:56:58 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 19 Mar 2008 - 17:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive