Nothing
selftest.bayes5.tck <- function(){
options(guiToolkit="tcltk")
w <- gwindow(title = "Bayesian applications in Ch 5")
size(w) <- c(700, 260)
g <- ggroup(container=w, horizontal=FALSE, use.scrollwindow = TRUE)
#------------- Question 1 -----------#
gp1 <- gframe(container = g, spacing = 2, pos = 0, horizontal = FALSE)
gp1.1 <- ggroup(container = gp1, spacing = 2, pos = 0, horizontal = TRUE)
q <- glabel("1) ", container = gp1.1, horizontal = TRUE)
font(q) <- list(weight = "bold")
qq <- glabel("A credible interval is...", container = gp1.1, anchor = c(-1,1))
font(qq) <- list(family = "cambria", size = 11)
ans1 <- c("(a) with a large number of repeated samples, 95% of such calculated intervals would include the \n true value of the parameter.",
"(b) the sampling distribution of an estimator.",
"(c) an interval in the domain of a posterior probability distribution.",
"(d) All of the above.")
f1 <- function(h,....){
if(tail(svalue(r1),1) == ans1[1]){
gmessage(msg="Incorrect", icon = "error")
}
if(tail(svalue(r1),1)== ans1[2]){
gmessage(msg="Incorrect", icon = "error")
}
if(tail(svalue(r1),1)== ans1[3]){
gmessage(msg="Correct")
}
if(tail(svalue(r1),1)== ans1[4]){
gmessage(msg="Incorrect", icon = "error")
}
svalue(r1) <- character(0)
}
r1 <- gcheckboxgroup(ans1, container = gp1, checked = FALSE, where = "beginning", handler = f1)
#------------- Question 2 -----------#
gp2 <- gframe(container = g, spacing = 2, pos = 0, horizontal = FALSE)
gp2.1 <- ggroup(container = gp2, spacing = 2, pos = 0, horizontal = TRUE)
q <- glabel("2) ", container = gp2.1, horizontal = TRUE)
font(q) <- list(weight = "bold")
qq <- glabel("We use Markov chains in Bayesian statistics...", container = gp2.1, anchor = c(-1,1))
font(qq) <- list(family = "cambria", size = 11)
ans2 <- c("(a) to create likelihood functions when priors are unknown.",
"(b) to sample from the likelihood dependent on data subsets.",
"(c) to describe the posterior distribution in cases when it is indescribable otherwise.",
"(d) All of the above.")
f2 <- function(h,....){
if(tail(svalue(r2),1) == ans2[1]){
gmessage(msg="Incorrect", icon = "error")
}
if(tail(svalue(r2),1)== ans2[2]){
gmessage(msg="Incorrect", icon = "error")
}
if(tail(svalue(r2),1)== ans2[3]){
gmessage(msg="Correct")
}
if(tail(svalue(r2),1)== ans2[4]){
gmessage(msg="Incorrect", icon = "error")
}
svalue(r2) <- character(0)
}
r2 <- gcheckboxgroup(ans2, container = gp2, checked = FALSE, where = "beginning", handler = f2)
#------------- Question 3 -----------#
gp3 <- gframe(container = g, spacing = 2, pos = 0, horizontal = FALSE)
gp3.1 <- ggroup(container = gp3, spacing = 2, pos = 0, horizontal = TRUE)
q <- glabel("3) ", container = gp3.1, horizontal = TRUE)
font(q) <- list(weight = "bold")
qq <- glabel("In a Markov chain...", container = gp3.1, anchor = c(-1,1))
font(qq) <- list(family = "cambria", size = 11)
ans3 <- c("(a) an outcome at step t +1 is only dependent on the outcome at step t.",
"(b) an outcome at step t +1 is only dependent on the outcome at step t - 1.",
"(c) an outcome at step t - 1 is dependent on the outcomes at the previous t - 2 steps.",
"(d) an outcome at step t is dependent on the outcomes at the previous t - 1 steps.")
f3 <- function(h,....){
if(tail(svalue(r3),1) == ans3[1]){
gmessage(msg="Correct")
}
if(tail(svalue(r3),1)== ans3[2]){
gmessage(msg="Incorrect", icon = "error")
}
if(tail(svalue(r3),1)== ans3[3]){
gmessage(msg="Incorrect", icon = "error")
}
if(tail(svalue(r3),1)== ans3[4]){
gmessage(msg="Incorrect", icon = "error")
}
svalue(r3) <- character(0)
}
r3 <- gcheckboxgroup(ans3, container = gp3, checked = FALSE, where = "beginning", handler = f3)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.