if (FALSE) {
### Finney data
data(vaso)
x<- vaso[,1:2]
y<- vaso[,3]
n<- rep(1,times=length(y))
finney.models<- rbind(
c(1, 0),
c(0, 1),
c(1, 1))
finney.glib <- glib (x,y,n, error="binomial", link="logit",
models=finney.models, glimvar=TRUE,
output.priorvar=TRUE, output.postvar=TRUE)
summary(finney.glib)
finney.bic.glm<- as.bic.glm(finney.glib)
plot(finney.bic.glm,mfrow=c(2,1))
}
### Yates (teeth) data.
x<- rbind(
c(0, 0, 0),
c(0, 1, 0),
c(1, 0, 0),
c(1, 1, 1))
y<-c(4, 16, 1, 21)
n<-c(1,1,1,1)
models<- rbind(
c(1, 1, 0),
c(1, 1, 1))
glib.yates <- glib ( x, y, n, models=models, glimvar=TRUE,
output.priorvar=TRUE, output.postvar=TRUE)
summary(glib.yates)
if (FALSE) {
### logistic regression with no models specified
library("MASS")
data(birthwt)
y<- birthwt$lo
x<- data.frame(birthwt[,-1])
x$race<- as.factor(x$race)
x$ht<- (x$ht>=1)+0
x<- x[,-9]
x$smoke <- as.factor(x$smoke)
x$ptl<- as.factor(x$ptl)
x$ht <- as.factor(x$ht)
x$ui <- as.factor(x$ui)
glib.birthwt<- glib(x,y, error="binomial", link = "logit")
summary(glib.birthwt)
glm.birthwt<- as.bic.glm(glib.birthwt)
imageplot.bma(glm.birthwt)
plot(glm.birthwt)
}
Run the code above in your browser using DataLab