# NOT RUN {
# data in octaves
v <- up <- c(0, 2^c(0:4), Inf)
dn <- c(-Inf, v[-length(v)])
i <- rbind( dn, up ) # intervals
f <- gjamSimData(n = 2000, S = 15, Q = 3, typeNames='CA')
y <- f$y
cc <- c(3:6) # censored columns
g <- gjamCensorY(values = v, intervals = i, y = y, whichcol = cc)
y[,cc] <- g$y # replace columns
ml <- list(ng = 500, burnin = 100, censor = g$censor, typeNames = f$typeNames)
output <- gjam(f$formula, xdata = f$xdata, ydata = y, modelList = ml)
#repeat with ng = 2000, burnin = 500, then:
pl <- list(trueValues = f$trueValues, width = 3, height = 3)
gjamPlot(output, pl)
# upper detection limit
up <- 5
v <- up
i <- matrix(c(up,Inf),2)
rownames(i) <- c('down','up')
f <- gjamSimData(typeNames='CA')
g <- gjamCensorY(values = v, intervals = i, y = f$y)
ml <- list(ng = 500, burnin = 100, censor = g$censor, typeNames = f$typeNames)
out <- gjam(f$formula, xdata = f$xdata, ydata = g$y, modelList = ml)
#repeat with ng = 2000, burnin = 500, then:
pl <- list(trueValues = f$trueValues, width = 3, height = 3)
gjamPlot(out, pl)
# lower detection limit
lo <- .001
values <- upper <- lo
intervals <- matrix(c(-Inf,lo),2)
rownames(intervals) <- c('lower','upper')
# }
Run the code above in your browser using DataLab