Reading Questions Answer Checker
To check your answers put them in the appropriate box and click the ‘Check’ button. Every checker box can do arithmetic and calculate standard functions (see calculator help). If you give decimal answers, give them to at least 3 decimal places.
As you work you should have pencil and paper handy for calculations and thinking!
Note: some questions ask for a formula. For the checker we ask you to plug a value into the formula. For your pset you still need to give the whole formula.
//DEBUG PARAMETERS //Because we don’t show solutions for pset checkers we use //this to give a showanswer button during the debugging phase var debugans = undefined; //release //var debugans = kDebugAnswer; //debug problemNumber = 0; wl(“Calculator”); writecalculator(“psetcheckcalcid”, “Calculate”); whr(kdivcol,kdivwid);
//Problem 1 problemNumber++; wl(problemheader(problemNumber)); var s; var partName, problemName, buttonLabel, answerArray, correct; s = [“Suppose our data $y ∼$ N$(θ, 6)$”, “where $θ$ is unknown.", “Suppose our prior for $θ$ is N(2, 10).", kp, “You run a five of experiments and collect the following data: “, “2, 2, 4, -1, 3.", kp, “Your posterior pdf for $θ$ is”, “$\\text’N’(μ_{\\text’post’}, σ^2_{\\text’post’})$.", kp, “What are $μ_{\\text’post’}$ and $σ^2_{\\text’post’}$ ?"]; wl(s.join(’ ‘)); wl(kp); s = “(i) $μ_{\\text’post’}$:"; wl(s); wl(kbr); partName = problemNumber + " (i)"; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; writeNumericBox(partName+"id”, 2, buttonLabel, 0.001, kuseCorrectVal); wl(kp); s = “(ii) $σ^2_{\\text’post’}$:"; wl(s); wl(kbr); partName = problemNumber + " (ii)"; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; writeNumericBox(partName+"id”, 1.0714, buttonLabel, 0.001, kuseCorrectVal); wl(kp); whr(kdivcol,kdivwid);
//Problem 2 problemNumber++; wl(problemheader(problemNumber)); var s; var partName, problemName, buttonLabel, answerArray, correct; s = [“Suppose we have a measurement $x ∼$ N($θ$, $σ^2$)", “where $θ$ is our parameter of interest and the variance”, “$σ^2$ is known. Suppose also that the prior pdf on $θ$ is normal.", kp, “If the prior pdf is shown in blue and the single data point is at the red line then what is the the posterior pdf?"]; wl(s.join(’ ‘)); wl(kp); wl(“”); wl(kbr); partName = problemNumber; problemName = “prob” + partName; buttonLabel = “Check problem " + partName; correct = “Cyan (plot 1)"; var answerArray = [correct,“Magenta (plot 2)",“Yellow (plot 3)", “Green (plot 4)"]; writeMultipleChoiceRadioGroup(answerArray, problemName, correct, buttonLabel); wl(kp); whr(kdivcol,kdivwid);