Learn R Programming

zoib (version 1.1)

AlcoholUse: California County-level Teenager Monthly Alcohol Use data

Description

AlcoholUse contains the county-level monthly alcohol use data from students in California in years 2008 to 2010. The data can be downloaded at http://www.kidsdata.org. The data has information on the percentage of public school students in grades 7, 9, and 11 in five buckets of days (0, 1-2, 3-9, 10-19, 20-30) in which they drank alcohol in the past 30 days. zoib is applied to examining whether the proportions of alhocol use in the past month are different across gender, grade, days of drinking.

Usage

data(AlcoholUse)

Arguments

source

http://www.kidsdata.org

References

Liu, F. and Kong, Y. (2015). ZOIB: an R Package for Bayesian Inferences in Beta and Zero One Inflated Beta Regression Models, submitted Liu, F. and Li, Q. (2014) A Bayesian Model for Joint Analysis of Multivariate Repeated Measures and Time to Event Data in Crossover Trials, Statistical Methods in Medical Research, doi: 10.1177/0962280213519594

Examples

Run this code
##### eg3: modelling with clustered beta variables with inflation at 0
  data("AlcoholUse", package = "zoib")
  AlcoholUse$Grade <- as.factor(AlcoholUse$Grade)

  post.obj <- zoib(Percentage ~ Grade+Days+Gender+Grade:Days+
              Grade:Gender+Days:Gender|1|Grade+Days+Gender+Grade:Days+
              Grade:Gender+Days:Gender|1, data = AlcoholUse, random = 1, 
              EUID= AlcoholUse$County, zero.inflation = TRUE, one.inflation = FALSE, 
               joint = FALSE, n.iter=5000, n.thin=20, n.burn=1000) 
	coeff <- post.obj$coeff
  traceplot(coeff)
  autocorr.plot(coeff) 
  check.psrf(coeff)
	summ <- summary(coeff))
  
  post.mean= apply(rbind(post.obj$ypred[[1]],post.obj$ypred[[2]]), 2, mean); 
  plot(AlcoholUse$Percentage,post.mean); abline(0,1,col='red')

Run the code above in your browser using DataLab