data(menarche,package="MASS")


summary(menarche)
plot(Menarche/Total ~ Age, data=menarche)

Age2=menarche$Age-13

x<-matrix(as.numeric(1.0),nrow=length(Age2),ncol=2)
x[,2]=Age2

y=menarche$Menarche/menarche$Total
wt=menarche$Total

mu<-matrix(as.numeric(0.0),nrow=2,ncol=1)
mu[2,1]=(log(0.9/0.1)-log(0.5/0.5))/3

V1<-1*diag(as.numeric(2.0))

# 2 standard deviations for prior estimate at age 13 between 0.1 and 0.9
## Specifies uncertainty around the point estimates

V1[1,1]<-((log(0.9/0.1)-log(0.5/0.5))/2)^2 
V1[2,2]=(3*mu[2,1]/2)^2  # Allows slope to be up to 3 times as large as point estimate 

out<-rglmb(n = 1000, y=y, x=x, pfamily=dNormal(mu=mu,Sigma=V1), weights = wt, 
           family = binomial(logit)) 
print(out)

alpha<-matrix(rep(0,length(y)),ncol=1)
wtin<-wt   ## From glm call (  )
dispersion2<-1
famfunc<-out$famfunc
f1=out$famfunc$f1
f4=out$famfunc$f4

DIC_Info(out$coefficients,y=y,x=x,alpha=alpha,
        f1=f1,f4=f4,wt=wtin/dispersion2,
        dispersion=dispersion2)



