library(gamselBayes)
# Generate some simple regression-type data:
set.seed(1) ; n <- 1000 ; x1 <- rbinom(n,1,0.5) ;
x2 <- runif(n) ; x3 <- runif(n) ; x4 <- runif(n)
y <- x1 + sin(2*pi*x2) - x3 + rnorm(n)
Xlinear <- data.frame(x1) ; Xgeneral <- data.frame(x2,x3,x4)
# Obtain a gamselBayes() fit for the data:
fitMCMC <- gamselBayes(y,Xlinear,Xgeneral)
summary (fitMCMC)
# Obtain a graphic for checking the chains:
checkChains(fitMCMC)
# \donttest{
if (require("Ecdat"))
{
# Obtain a gamselBayes() fit for data on schools in California, U.S.A.:
Caschool$log.avginc <- log(Caschool$avginc)
mathScore <- Caschool$mathscr
Xgeneral <- Caschool[,c("mealpct","elpct","calwpct","compstu","log.avginc")]
fitMCMC <- gamselBayes(y = mathScore,Xgeneral = Xgeneral)
summary(fitMCMC)
# Obtain a graphic for checking the chains:
checkChains(fitMCMC)
}
# }
Run the code above in your browser using DataLab