diff --git a/.mapping.json b/.mapping.json index 42a6f4c..f618943 100755 --- a/.mapping.json +++ b/.mapping.json @@ -1 +1 @@ -{"source/main.ptx": ["my-great-book"], "source/frontmatter.ptx": ["frontmatter", "front-colophon"], "source/ch-Introduction.ptx": ["ch-Introduction", "sec-Introduction"], "source/ch-Probability.ptx": ["ch-Probability"], "source/sec-Set-Theory.ptx": ["sec-Set-Theory"], "source/sec-Probability.ptx": ["sec-Probability"], "source/sec-Conditional-Probability.ptx": ["sec-Conditional-Probability"], "source/sec-Independent-Events.ptx": ["sec-Independent-Events"], "source/ch-Random-Variables.ptx": ["ch-Random-Variables"], "source/sec-Discrete-RVs.ptx": ["sec-Discrete-RVs"], "source/sec-Continuous-RVs.ptx": ["sec-Continuous-RVs"], "source/sec-Joint-Distributions.ptx": ["sec-Joint-Distributions"], "source/ch-Expected-Value.ptx": ["ch-Expected-Value"], "source/sec-Expected-Value.ptx": ["sec-Expected-Value"], "source/sec-Variance.ptx": ["sec-Variance"], "source/sec-Covariance.ptx": ["sec-Covariance"], "source/ch-Confidence-Intervals.ptx": ["ch-Confidence-Intervals", "sec-CLT", "sec-Confidence-Intervals"], "source/ch-Hypothesis-Testing.ptx": ["ch-Hypothesis-Testing", "sec-One-Sample-Tests", "sec-Two-Sample-Tests", "sec-Power", "sec-Chi-Squared"], "source/ch-Linear-Regression.ptx": ["ch-Linear-Regression", "sec-Correlation", "sec-Linear-Regression"], "source/backmatter.ptx": ["backmatter"]} \ No newline at end of file +{"source/main.ptx": ["my-great-book", "frontmatter", "front-colophon", "ch-Introduction", "sec-Introduction", "ch-Probability", "sec-Set-Theory", "sec-Probability", "sec-Conditional-Probability", "sec-Independent-Events", "ch-Random-Variables", "sec-Discrete-RVs", "sec-Continuous-RVs", "sec-Joint-Distributions", "ch-Expected-Value", "sec-Expected-Value", "sec-Variance", "sec-Covariance", "ch-Confidence-Intervals", "sec-Likelihood", "sec-CLT", "sec-Confidence-Intervals", "ch-Hypothesis-Testing", "sec-One-Sample-Tests", "sec-Two-Sample-Tests", "sec-Power", "sec-Chi-Squared", "ch-Linear-Regression", "sec-Correlation", "sec-Linear-Regression", "backmatter"]} \ No newline at end of file diff --git a/_static/._39.47c68f7dc05f7c3e.js b/_static/._39.47c68f7dc05f7c3e.js new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._39.47c68f7dc05f7c3e.js differ diff --git a/_static/._39.47c68f7dc05f7c3e.js.LICENSE.txt b/_static/._39.47c68f7dc05f7c3e.js.LICENSE.txt new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._39.47c68f7dc05f7c3e.js.LICENSE.txt differ diff --git a/_static/._39.47c68f7dc05f7c3e.js.gz b/_static/._39.47c68f7dc05f7c3e.js.gz new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._39.47c68f7dc05f7c3e.js.gz differ diff --git a/_static/._39.47c68f7dc05f7c3e.js.map b/_static/._39.47c68f7dc05f7c3e.js.map new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._39.47c68f7dc05f7c3e.js.map differ diff --git a/_static/._39.47c68f7dc05f7c3e.js.map.gz b/_static/._39.47c68f7dc05f7c3e.js.map.gz new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._39.47c68f7dc05f7c3e.js.map.gz differ diff --git a/_static/._420.930dc253cc191e9e.js b/_static/._420.930dc253cc191e9e.js new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._420.930dc253cc191e9e.js differ diff --git a/_static/._420.930dc253cc191e9e.js.LICENSE.txt b/_static/._420.930dc253cc191e9e.js.LICENSE.txt new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._420.930dc253cc191e9e.js.LICENSE.txt differ diff --git a/_static/._420.930dc253cc191e9e.js.gz b/_static/._420.930dc253cc191e9e.js.gz new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._420.930dc253cc191e9e.js.gz differ diff --git a/_static/._420.930dc253cc191e9e.js.map b/_static/._420.930dc253cc191e9e.js.map new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._420.930dc253cc191e9e.js.map differ diff --git a/_static/._420.930dc253cc191e9e.js.map.gz b/_static/._420.930dc253cc191e9e.js.map.gz new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._420.930dc253cc191e9e.js.map.gz differ diff --git a/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js b/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js differ diff --git a/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js.gz b/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js.gz new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js.gz differ diff --git a/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js.map b/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js.map new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js.map differ diff --git a/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js.map.gz b/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js.map.gz new file mode 100755 index 0000000..d4c6384 Binary files /dev/null and b/_static/._prefix-runtime.0d5f811896ddeac1.bundle.js.map.gz differ diff --git a/_static/249.7ec032cf0b3ede9a.js.gz b/_static/249.7ec032cf0b3ede9a.js.gz index c83f3ef..46bbf8d 100755 Binary files a/_static/249.7ec032cf0b3ede9a.js.gz and b/_static/249.7ec032cf0b3ede9a.js.gz differ diff --git a/_static/39.47c68f7dc05f7c3e.js b/_static/39.47c68f7dc05f7c3e.js new file mode 100755 index 0000000..bf9a167 --- /dev/null +++ b/_static/39.47c68f7dc05f7c3e.js @@ -0,0 +1,3 @@ +/*! For license information please see 39.47c68f7dc05f7c3e.js.LICENSE.txt */ +(self.webpackChunkWebComponents=self.webpackChunkWebComponents||[]).push([[39,420],{52420:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>_});var s=i(78673);i(75794),i(56906),i(78811);class n{constructor(e){this.problem=e}inverseLISIndices(e){for(var t=[],i=0;in&&rh&&(h=c.length,l=c)}var d=[],u=0;for(let t=0;tl.length?d.push(t):e[t]==l[u]?u+=1:d.push(t);return d}grade(){var e=this.problem;e.clearFeedback(),this.correctLines=0,this.percentLines=0,this.incorrectIndents=0;var t,i=e.solution,s=e.answerLines();this.percentLines=Math.min(s.length,i.length)/Math.max(s.length,i.length),s.lengthe[s].indent&&this.indentLeft.push(t[s]);return this.incorrectIndents=this.indentLeft.length+this.indentRight.length,0==this.incorrectIndents}checkCorrectOrdering(e,t){let i=!0;this.correctLines=0,this.solutionLength=e.length;let s=Math.min(e.length,t.length);for(let n=0;n0&&u.length>0;)if(c.length<=u.length){a=c,c=[];for(let e of a)for(let t of o(e))if(l.has(t)||(c.push(t),l.set(t,e)),h.has(t))return[l,h,t]}else{a=u,u=[];for(let e of a)for(let t of r(e))if(h.has(t)||(u.push(t),h.set(t,e)),l.has(t))return[l,h,t]}throw new d("No path between "+t.toString()+" and "+i.toString()+".")}(e,t,i),o=[];null!=r;)o.push(r),r=s.get(r);for(r=n.get(o[0]),o.reverse();null!=r;)o.push(r),r=n.get(r)}(e,t,i)}catch(e){if(e instanceof d)return!1;throw e}return!0}class o{constructor(){this.graph={},this.node=new Map,this.adj=new Map,this.pred=new Map,this.succ=this.adj,this.edge=this.adj}addNode(e){this.succ.has(e)||(this.succ.set(e,new Map),this.pred.set(e,new Map),this.node.set(e))}addEdge(e,t){this.succ.has(e)||(this.succ.set(e,new Map),this.pred.set(e,new Map),this.node.set(e,{})),this.succ.has(t)||(this.succ.set(t,new Map),this.pred.set(t,new Map),this.node.set(t,{}));var i=this.adj.get(e).get(t)||{};this.succ.get(e).set(t,i),this.pred.get(t).set(e,i)}nodes(e=!1){return Array.from(e?this.node.entries():this.node.keys())}edges(e,t=!1){return Array.from(this.edgesIter(e,t))}nodesIter(e=!1){return e?toIterator(this.node):this.node.keys()}get(e){var t=this.adj.get(e);if(void 0===t)throw new KeyError("Graph does not contain node "+e+".");return t}numberOfNodes(){return this.node.size}*nbunchIter(e){if(null==e)yield*this.adj.keys();else if(this.hasNode(e))yield e;else{var t=this.adj;try{for(var i of toIterator(e))t.has(i)&&(yield i)}catch(e){if(e instanceof TypeError)throw new h("nbunch is not a node or a sequence of nodes")}}}*edgesIter(e,t=!1){var i;for(var s of((!0===(i=e)||!1===i||function(e){return!!e&&"object"==typeof e}(i)&&"[object Boolean]"==Object.prototype.toString.call(i))&&(t=e,e=void 0),void 0===e?this.adj:mapIterator(this.nbunchIter(e),(e=>tuple2(e,this.adj.get(e))))))for(var n of s[1]){var r=[s[0],n[0]];t&&(r[2]=n[1]),yield r}}reverse(e=!0){var t;if(e)(t=new this.constructor(null,{name:"Reverse of ("+this.name+")"})).addNodesFrom(this),t.addEdgesFrom(mapIterator(this.edgesIter(null,!0),(e=>tuple3c(e[1],e[0],deepcopy(e[2]),e)))),t.graph=deepcopy(this.graph),t.node=deepcopy(this.node);else{var i=this.pred,s=this.succ;this.succ=i,this.pred=s,this.adj=this.succ,t=this}return t}successorsIter(e){var t=this.succ.get(e);if(void 0!==t)return t.keys();throw new h(sprintf('The node "%j" is not in the digraph.',e))}predecessorsIter(e){var t=this.pred.get(e);if(void 0!==t)return t.keys();throw new h(sprintf('The node "%j" is not in the digraph.',e))}successors(e){return Array.from(this.successorsIter(e))}predecessors(e){return Array.from(this.predecessorsIter(e))}}class a{constructor(e){this.name="JSNetworkXException",this.message=e}}class l extends a{constructor(e){super(e),this.name="JSNetworkXAlgorithmError"}}class h extends a{constructor(e){super(e),this.name="JSNetworkXError"}}class c extends l{constructor(e){super(e),this.name="JSNetworkXUnfeasible"}}class d extends c{constructor(e){super(e),this.name="JSNetworkXNoPath"}}function u(e){var t=new o;for(let i of e){t.addNode(i.tag);for(let e of i.depends)t.addEdge(e,i.tag)}return t}function p(e,t){for(let i of e.edges())if(!t.has(i[0])&&!t.has(i[1]))return!1;return!0}class v extends n{inverseLISIndices(e,t){var i=this.problem.solution,s=t.map((e=>e.lines[0]));let n=u(i),a=new Set,l=new o;for(let e of s){for(let t of a)r(n,{source:e.tag,target:t.tag})&&l.addEdge(e.tag,t.tag);a.add(e)}let h=null,c=function(e){let t={};for(let i=0;i<=e.length;i++)t[i]=[];for(let i=0;i{for(let t=0;ti&&this.indentLeft.push(e.lines[0])}return this.incorrectIndents=this.indentLeft.length+this.indentRight.length,0==this.incorrectIndents}checkCorrectOrdering(e,t){if(!function(e){try{return function(e,t){var i=new Set,s=[],n=new Set;null==t&&(t=e.nodesIter());for(let l of t){if(n.has(l))return;for(var r=[l];r.length>0;){var o=r[r.length-1];if(n.has(o))r.pop();else{i.add(o);var a=[];e.get(o).forEach((function(e,t){if(!n.has(t)){if(i.has(t))throw new c("Graph contains a cycle.");a.push(t)}})),a.length>0?r.push.apply(r,a):(n.add(o),s.unshift(o))}}}}(e),!0}catch(e){if(e instanceof c)return!1;throw e}}(u(e)))throw"Dependency between blocks does not form a Directed Acyclic Graph; Problem unsolvable.";let i=new Set,s=!0;this.correctLines=0,this.solutionLength=e.length;let n=Math.min(e.length,t.length);for(let e=0;ee.trimStart().toLowerCase().startsWith("class ")))?this.text.toLowerCase().startsWith("class")?this.indent=0:this.indent=n.length-this.text.length:this.text.toLowerCase().startsWith("def")?this.indent=0:this.indent=n.length-this.text.length}else this.text=n.replace(/^\s*/,""),this.indent=n.length-this.text.length;"natural"==e.options.language||"math"==e.options.language?s=i?document.createElement("div"):document.createElement("p"):(s=document.createElement("code"),$(s).addClass(e.options.prettifyLanguage)),s.id=e.counterId+"-line-"+this.index,s.innerHTML+=this.text,this.view=s,e.lines.push(this)}initializeWidth(){this.width=$(this.view).outerWidth(!0)-this.problem.options.pixelsPerIndent*this.indent,this.view.fontSize=window.getComputedStyle(this.view,null).getPropertyValue("font-size"),this.view.pixelsPerIndent=this.problem.options.pixelsPerIndent,this.view.indent=this.indent;var e=document.createElement("canvas").getContext("2d"),t=window.getComputedStyle(this.view,null).getPropertyValue("font-family").split(", "),i="abcdefghijklmnopqrstuvwxyz0123456789,./!@#$%^&*-+";e.font=this.view.fontSize+" serif";var s=e.measureText(i).width;for(let n=0;n0&&$(o.view).addClass("indent"+r),n.appendChild(o.view)}var a=document.createElement("div");$(a).addClass("labels"),"left"==this.problem.options.numbered?($(n).addClass("border_left"),$(i).prepend(a),$(i).css({"justify-content":"flex-start"})):"right"==this.problem.options.numbered&&($(a).addClass("border_left"),$(a).css({float:"right"}),$(i).css({"justify-content":"space-between"}),$(i).append(a)),this.view=i,this.isPlaceholder=!1}addLine(e){if($(e.view).removeClass("indent1 indent2 indent3 indent4 indent5 indent6"),this.problem.noindent)e.indent>0&&$(e.view).addClass("indent"+e.indent);else{var t=this.lines,i=t[0].indent;for(let e=1;ee.indent)for(let i=0;i0&&($(e.view).removeClass("indent1 indent2 indent3 indent4 indent5 indent6"),$(e.view).addClass("indent"+e.indent))}this.indent=0,$(this.view).css({"padding-left":"",width:this.problem.areaWidth-22})}addLabel(e,t){var i=document.createElement("div");$(i).addClass("block-label"),"right"==this.problem.options.numbered&&$(i).addClass("right-label"),"left"==this.problem.options.numbered&&$(i).addClass("left-label"),$(i).append(document.createTextNode(e)),$(this.view).children(".labels")[0].append(i),0!=this.labels.length&&$(i).css("margin-top",(t-this.labels[this.labels.length-1][1]-1)*this.lines[t].view.offsetHeight),this.labels.push([e,t])}initializeInteractivity(){if($(this.view).hasClass("disabled"))return this;$(this.view).attr("tabindex","-1"),this.hammer=new(m().Manager)(this.view,{recognizers:[[m().Pan,{direction:m().DIRECTION_ALL,threshold:0,pointers:1}]]});var e=this;this.hammer.on("panstart",(function(t){e.panStart(t)})),this.hammer.on("panend",(function(t){e.panEnd(t)})),this.hammer.on("panmove",(function(t){e.panMove(t)}))}enabled(){return void 0!==$(this.view).attr("tabindex")}isDistractor(){return this.lines[0].distractor}inSourceArea(){var e=this.problem.sourceArea.childNodes;for(let t=0;t=0;s--){var i=e[s];if(i.pairedBin()==t)return i}return e[e.length-1]}}pairedBin(){for(var e=this.problem.pairedBins,t=0;t=0){for(e=0;e0)return s}for(e=0;e=s)break}this.problem.textMoving=!0,this.problem.sourceArea.insertBefore(this.view,t.view),$(this.view).focus()}else this.indent=this.indent-1;this.problem.state=void 0,this.problem.updateView()}}moveUp(){if(this.inSourceArea()){let n=this.problem.sourceBlocks();var e=this.verticalOffset(),t=this.validSourceIndexes();for(let r=0;r=e)return this.problem.textMoving=!0,this.problem.answerArea.insertBefore(this.view,s.view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView(),this}this.problem.textMoving=!0,this.problem.answerArea.appendChild(this.view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView()}else this.indent!==this.problem.indent&&(this.indent=this.indent+1,this.problem.state=void 0,this.problem.updateView())}moveDown(){if(this.inSourceArea()){let s=this.problem.sourceBlocks();var e=this.validSourceIndexes();for(let e=0;e1)return this.problem.textMoving=!0,this.problem.sourceArea.insertBefore(this.view,s[i].view),$(this.view).focus(),this.problem.state=void 0,this.problem.updateView(),this}}else{let e=this.problem.answerBlocks();for(var s=0;s=0;i--){var s=e[i];if(t)return this.problem.textFocus=s,s.makeTabIndex(),$(s.view).focus(),this;s.view.id==this.view.id&&(t=!0)}}selectRight(){if(this.inSourceArea()){var e=this.verticalOffset(),t=this.problem.enabledAnswerBlocks();if(0==t.length)return this;for(var i=t[0],s=i.verticalOffset()-e,n=1;n1?`${i} blocks are missing here`:`${i} block is missing here`,$(this.view).append(n),this.isPlaceholder=!0}}class k extends g{constructor(e){super(e,"placeholder",!1),this.isPlaceholderLine=!0}}class y extends b{constructor(e,t){super(e,t),this.isSettled=!0,$(this.view).addClass("settled-block"),$(this.view).addClass("disabled");let i=document.createElement("span");i.classList.add("settled-tooltip"),$(this.view).append(i),$(this.view).find(".settled-tooltip").text("OK")}setBlocksBefore(e){this.blocksBefore=e;var t=e>1?"s":"";if(this.blocksAfter){var i=this.blocksAfter>1?"s":"";$(this.view).find(".settled-tooltip").html(`${e} block${t} ⬆️️), ${this.blocksAfter} block${i} ⬇️`)}else $(this.view).find(".settled-tooltip").html(`${e} block${t} ⬆️️`)}setBlocksAfter(e){this.blocksAfter=e;var t=e>1?"s":"";if(this.blocksBefore){var i=this.blocksBefore>1?"s":"";$(this.view).find(".settled-tooltip").html(`${this.blocksBefore} block${i} ⬆️, ${e} block${t} ⬇️`)}else $(this.view).find(".settled-tooltip").html(`${e} block${t} ️️⬇️`)}}class x extends s.A{constructor(e){super(e);var t=e.orig;this.containerDiv=t,this.origElem=$(t).find("pre.parsonsblocks")[0],this.question=$(t).find(".parsons_question")[0],this.useRunestoneServices=e.useRunestoneServices,this.divid=e.orig.id;var i=super.localStorageKey();this.storageId=i,this.children=this.origElem.childNodes,this.contentArray=[],x.counter++,this.counterId="parsons-"+x.counter,this.initializeOptions(),this.grader="dag"===this.options.grader?new v(this):new n(this),this.grader.showfeedback=this.showfeedback;var s=$(this.origElem).html();this.blockIndex=0,this.checkCount=0,this.numDistinct=0,this.hasSolved=!1,this.initializeLines(s.trim()),this.initializeView(),this.caption="Parsons",this.addCaption("runestone"),this.checkServer("parsons",!0),this.runnableDiv=null}initializeOptions(){var e={pixelsPerIndent:30},t=$(this.origElem).data("maxdist"),i=$(this.origElem).data("order"),s=$(this.origElem).data("noindent"),n=$(this.origElem).data("adaptive"),r=$(this.origElem).data("numbered"),o=$(this.origElem).data("grader"),a=$(this.origElem).data("scaffolding");if(e.numbered=r,e.grader=o,e.scaffolding=a,void 0!==t&&(e.maxdist=t),void 0!==i){i=i.match(/\d+/g);for(var l=0;le.replace(/\s+/g,"")))).indexOf("#tag:"),""==(y=o.substring(w+5,o.indexOf(";",w+5)))&&(y="block-"+r),x=o.indexOf(";depends:");let e=o.substring(x+9,o.indexOf(";",x+9));h=e.length>0?e.split(","):[]}if(o.includes('class="displaymath')?a.displaymath=!0:a.displaymath=!1,o=o.replace(/#(paired|distractor|settled|tag:.*;.*;)/,(function(e,t){return a[t]=!0,""})),a.settled&&r>0&&u.length>0&&!u[u.length-1].isSettled){var d=new k(this);u.push(d),d.distractor=!0,d.paired=!1,d.distractHelptext="",d.groupWithNext=!1,d.indent=0}a.settled&&(n=!0);var u=[];if(a.displaymath)p=[o];else var p=o.split("\n");for(var v=0;v0){for(v=0;v0&&(n-=1),t.indent=n}}else{s=s.sort((function(e,t){return e-t}));for(let e=0;ee.replace(/\s+/g,"")))).indexOf("#tag:"),""==(y=o.substring(w+5,o.indexOf(";",w+5)))&&(y="block-"+r),x=o.indexOf(";depends:");let e=o.substring(x+9,o.indexOf(";",x+9));h=e.length>0?e.split(","):[]}if(o.includes('class="displaymath')?a.displaymath=!0:a.displaymath=!1,o=o.replace(/\s*#(paired|distractor|tag:.*;.*;)\s*/g,(function(e,t){return a[t]=!0,""})),u=[],a.displaymath)p=[o];else p=o.split("\n");for(v=0;v0){for(v=0;vawait f.queueMathJax(e[0]))):void 0!==MathJax.startup&&await f.queueMathJax(e[0])),u=Math.max(u,e.outerWidth(!0)),e.width(u-22);var t=3.8;let i=e.outerHeight(!0);38!=i&&(t=3.1*(i-38)/21),p+=i+g*t}.bind(this),s=0;s0&&a<=4?$(this.answerArea).addClass("answer"+a):$(this.answerArea).addClass("answer");var m=[],b=[];for(s=0;s0&&(m.push(b),b=[]):(b.push(w),w.groupWithNext||(m.push(b),b=[]))}var k,y=[],x=[],_=[];if(this.pairDistractors||!this.options.adaptive){for(s=m.length-1;s>-1;s--)if((b=m[s])[0].paired)for(k=b.length-1;k>-1;k--)x.unshift(b[k].index);else if(x.length>0){for(k=b.length-1;k>-1;k--)x.unshift(b[k].index);y.unshift(x),x=[]}for(s=0;sor{"),_.push(C),this.sourceArea.appendChild(C)}}else y=[];p+=10*y.length,this.areaHeight=p+40,$(this.sourceArea).css({width:this.areaWidth+2,height:p}),$(this.answerArea).css({width:this.options.pixelsPerIndent*a+this.areaWidth+2,height:p}),this.pairedBins=y,this.pairedDivs=_,null!=this.options.numbered&&this.addBlockLabels(e.concat(t)),this.state=void 0,this.updateView(),h&&$(l).replaceWith(this.outerDiv)}initializeInteractivity(){for(var e=0;e(s=this.dateFromTimestamp(s))?e:t}async loadData(e){try{if(!0===this.options.scaffolding){null==(i=e.source)&&(i=e.trash);var t=e.answer;void 0!==(n=null==(s=e.adaptive)?{}:this.optionsFromHash(s)).noindent&&(this.noindent=!0),void 0!==n.checkCount&&(this.checkCount=n.checkCount),void 0!==n.hasSolved&&(this.hasSolved=n.hasSolved),await this.initializeAreas(this.blocksFromSource(),this.settledBlocksFromSource(),n)}else{var i,s,n;null==(i=e.source)&&(i=e.trash),t=e.answer,void 0!==(n=null==(s=e.adaptive)?{}:this.optionsFromHash(s)).noindent&&(this.noindent=!0),void 0!==n.checkCount&&(this.checkCount=n.checkCount),void 0!==n.hasSolved&&(this.hasSolved=n.hasSolved),null==i||null==t||1==t.length?await this.initializeAreas(this.blocksFromSource(),[],n):(this.initializeAreas(this.blocksFromHash(i),this.blocksFromHash(t),n),this.grade=this.grader.grade(),"correct"==this.grade?this.correct=!0:0==this.answerLines().length?this.correct=null:this.correct=!1)}}catch(t){await this.initializeAreas(this.blocksFromSource(),[],n),console.log(`Error restoring answer for student ${e.sid} in ${e.div_id}. Defaulting to original state.`)}!0!==this.needsReinitialization&&(this.initializeInteractivity(),this.isTimed&&!this.assessmentTaken&&this.resetView())}localData(){var e=localStorage.getItem(this.storageId);return null!==e&&"{"==e.charAt(0)?JSON.parse(e):{}}restoreAnswers(e){this.loadData(e)}checkLocalStorage(){this.graderactive||this.loadData(this.localData())}setLocalStorage(e){var t;if(null==e){t={source:this.sourceHash(),answer:this.answerHash(),timestamp:new Date};var i=this.adaptiveHash();i.length>0&&(t.adaptive=i)}else t=e;localStorage.setItem(this.storageId,JSON.stringify(t))}async updatePlaceholders(){setTimeout((()=>{var e,t,i,s=this.answerBlocks();for(e=0;e0&&!s[e-1].isSettled&&!s[e-1].isPlaceholder&&(t=!0),e{for(var e=this.answerBlocks(),t=0;t=t;o--)if(e[o].afterSettledBlockCount==r){n=e[o];break}if(e[o].afterSettledBlockCount!=r)return void console.log("error moving up; no placeholder found");if($(n.view).hasClass("hide")){$(n.view).removeClass("hide");for(var a=0;a0&&(i.disabled=s),i}answerHash(){for(var e=[],t=this.answerBlocks(),i=0;ib&&(f-=1),t.lines[t.lines.length-1].indent==g.lines[0].indent&&(f+=1),f>=p&&(p=f,v=u)}for(t=d[v],g=d[v+1],u=0;u-1?r.push(t):a.push(s):r.push(t);n=r,r=[]}}if(this.recentAttempts<2?this.pairDistractors=!1:this.pairDistractors=!0,void 0===this.options.order){var c=[],d=[];for(s=0;s1)for(d=this.shuffled(d),p=0;p=0){for(var p=s;$.inArray(e[p-1],r)<0;)p--;var v=$.inArray(e[p-1],r),g=$.inArray(e[s],r);r.splice(g,1),r.splice(v,0,e[s])}return r}blockFromHash(e){for(var t=e.split("_"),i=[],s=0;s0&&l.setBlocksBefore(a),o=l,r++,n=0,s=[]}else s[0].distractor||n++,s=[];return i.length>0&&i[i.length-1].isSettled&&(this.lastBlockSettled=!0),console.log("settledblocksfromsource",i),i}getBlockById(e){for(var t=0;t1?$.i18n("msg_parson_correct",this.checkCount):$.i18n("msg_parson_correct_first_try");this.options.runnable&&(i+=" "+$.i18n("msg_parson_correct_runnable")),setTimeout((()=>{e.html(i)}),10)}if("incorrectTooShort"===this.grade&&(t.addClass("incorrect"),this.messageDiv.style.visibility="visible",e.attr("class","alert alert-danger"),setTimeout((()=>{e.html($.i18n("msg_parson_too_short"))}),10)),"incorrectIndent"===this.grade){var i=[];for(let e=0;e{1==i.length?e.html($.i18n("msg_parson_wrong_indent")):e.html($.i18n("msg_parson_wrong_indents"))}),10)}if("incorrectMoveBlocks"===this.grade){var s=this.answerBlocks(),n=[],r=[],o=[];for(let e=0;e{e.html($.i18n("msg_parson_wrong_order"))}),10)}}initializeAdaptive(){if(this.adaptiveId=super.localStorageKey(),this.canHelp=!0,this.checkCount=0,this.numDistinct=0,this.gotHelp=!1,localStorage.getItem(this.adaptiveId+"Problem")==this.divid)return this.checkCount=localStorage.getItem(this.adaptiveId+this.divid+"Count"),null==this.checkCount&&(this.checkCount=0),this;var e=localStorage.getItem(this.adaptiveId+this.divid+"Count");null!=e&&"NaN"!=e||(e=0),this.checkCount=e,this.recentAttempts=localStorage.getItem(this.adaptiveId+"recentAttempts"),null!=this.recentAttempts&&"NaN"!=this.recentAttempts||(this.recentAttempts=3),localStorage.setItem(this.adaptiveId+"recentAttempts",this.recentAttempts),localStorage.setItem(this.adaptiveId+"Problem",this.divid),localStorage.setItem(this.adaptiveId+this.divid+"Count",this.checkCount),localStorage.setItem(this.adaptiveId+"Solved",!1)}usesIndentation(){return!this.noindent&&0!=this.solutionIndent()}distractorToRemove(){var e,t=this.enabledAnswerBlocks();for(let i=0;i{t.html($.i18n("msg_parson_not_solution"))}),10),e.lines[0].distractHelptext&&(e.view.setAttribute("data-toggle","tooltip"),e.view.setAttribute("title",e.lines[0].distractHelptext)),e.disable(),e.inSourceArea())$(e.view).css({"border-color":"#000","background-color":"#fff"}),$(e.view).animate({opacity:.3,"border-color":"#d3d3d3","background-color":"#efefef"},{duration:2e3,complete:function(){$(e.view).css({"border-color":"","background-color":""})}});else{var i=this.sourceArea.getBoundingClientRect(),s=e.pageXCenter()-1,n=e.pageYCenter(),r=i.left+window.pageXOffset+i.width/2,o=i.top+window.pageYOffset+e.view.getBoundingClientRect().height/2,a=e.slideUnderBlock();void 0!==a&&(o+=a.view.getBoundingClientRect().height+20,o+=parseInt($(a.view).css("top")));var l=this;$(e.view).css({"border-color":"#000","background-color":"#fff"}),$(e.view).animate({opacity:1},{duration:4*Math.sqrt(Math.pow(o-n,2)+Math.pow(r-s,2))+500,start:function(){l.moving=e,l.movingX=s,l.movingY=n,l.updateView()},progress:function(e,t,i){l.movingX=s*(1-t)+r*t,l.movingY=n*(1-t)+o*t,l.updateView()},complete:function(){delete l.moving,delete l.movingX,delete l.movingY,l.updateView(),$(e.view).animate({opacity:.3,"border-color":"#d3d3d3","background-color":"#efefef"},{duration:1e3,complete:function(){$(e.view).css({opacity:"","border-color":"","background-color":""}),$(e.view).addClass("disabled")}})}})}}removeIndentation(){var e=$(this.messageDiv);this.messageDiv.style.visibility="visible",e.attr("class","alert alert-info"),setTimeout((()=>{e.html($.i18n("msg_parson_provided_indent"))}),10);for(var t,i,s=200,n=0;n0&&t.indexOf(s)<0)return s;return null}getFurthestBlock(){for(var e=this.solutionBlocks(),t=this.answerBlocks(),i=0,s=0,n=null,r=null,o=0,a=null,l=0,h=0;h0&&(a=e[o-1],l=t.indexOf(a),(s=Math.abs(h-l))>i&&(i=s,n=r));return n}combineBlocks(){var e=this.solutionBlocks(),t=this.answerBlocks(),i=this.sourceBlocks(),s=$(this.messageDiv);this.messageDiv.style.visibility="visible",s.attr("class","alert alert-info"),setTimeout((()=>{s.html($.i18n("msg_parson_combined_blocks"))}),10);var n=null,r=null;null==(r=this.getSolutionBlockInSource())&&(r=this.getFurthestBlock());var o=e.indexOf(r);n=e[o-1];var a=t.indexOf(n),l=t.indexOf(r),h=!1;a>=0&&l>=0?h=a+1!==l:a<0&&l<0?h=(a=i.indexOf(n))+1!==(l=i.indexOf(r)):(h=!0,a<0&&(a=i.indexOf(n)),l<0&&(l=i.indexOf(r)));var c=l3?(alert($.i18n("msg_parson_will_combine")),this.combineBlocks(),this.logMove("combinedBlocks")):(alert($.i18n("msg_parson_three_blocks_left")),this.canHelp=!1):(alert($.i18n("msg_parson_remove_incorrect")),this.removeDistractor(e),this.logMove("removedDistractor-"+e.hash()))}helpMe(){this.clearFeedback(),this.numDistinct<3?alert($.i18n("msg_parson_atleast_three_attempts")):(this.gotHelp=!0,this.makeEasier())}dateFromTimestamp(e){var t=new Date(e);if(isNaN(t.getTime())){var i=e.split(/[- :]/);t=new Date(i[0],i[1]-1,i[2],i[3],i[4],i[5])}return t}shuffled(e){for(var t,i,s=e.length,n=e.slice();0!==s;)i=Math.floor(Math.random()*s),t=n[s-=1],n[s]=n[i],n[i]=t;return n}enterKeyboardMode(){$(this.keyboardTip).show(),$(this.sourceLabel).hide(),$(this.answerLabel).hide(),this.clearFeedback()}exitKeyboardMode(){$(this.keyboardTip).hide(),$(this.sourceLabel).show(),$(this.answerLabel).show()}clearFeedback(){$(this.answerArea).removeClass("incorrect correct");for(var e=this.answerArea.childNodes,t=0;t=i.left&&e<=i.right&&t>=i.top&&t<=i.bottom?"answer":e>=(i=this.sourceArea.getBoundingClientRect()).left&&e<=i.right&&t>=i.top&&t<=i.bottom?"source":"moving"}updateView(){var e,t,i,s=this.state,n=this.movingState(),r=!0,o=!0,a="moving"==n;s==n&&("rest"==n?(r=!1,o=!1):"source"==n?o=!1:"answer"==n?r=!1:"moving"==n&&(o=!1,r=!1)),void 0!==this.moving&&(e=$(this.moving.view).outerHeight(!0),$(this.moving.view).detach());var l,h,c=this.areaWidth-22;if(r){t=0;var d=this.sourceBlocks();if("source"==n){var u=!1,p=this.moving.pairedBin(),v=[];for(y=0;yor{")}1==_.length&&$(C).html("")}}if(o)if(t=0,i=this.areaWidth+this.indent*this.options.pixelsPerIndent-22,d=this.answerBlocks(),"answer"==n){u=!1,f=this.movingX-this.answerArea.getBoundingClientRect().left-window.pageXOffset-c/2-11;var A=Math.round(f/this.options.pixelsPerIndent);for(A<0?A=0:A>this.indent?A=this.indent:f=A*this.options.pixelsPerIndent,m=this.movingY-this.answerArea.getBoundingClientRect().top-window.pageYOffset,this.moving.indent=A,y=0;y=10&&(o+=" "),e[a].addLabel(o,0),s++}n+this.pairedBins.length>=10&&(this.areaWidth+=5,$(this.sourceArea).css({width:$(this.sourceArea).width()+5}),$(this.answerArea).css({width:$(this.answerArea).width()+5}))}resetView(){if(this.clearFeedback(),!0===this.options.scaffolding){const e=document.querySelector(`#copy-answer-button-${this.divid}`);e&&e.classList.add("copy-button-hide")}var e,t=document.body.scrollTop;for(let t=0;t{$.i18n().load({"pt-br":{msg_parson_check_me:"Verificar",msg_parson_reset:"Resetar",msg_parson_help:"Ajuda",msg_parson_too_short:"Seu programa é muito curto. Adicione mais blocos.",msg_parson_drag_from_here:"Arraste daqui",msg_parson_drag_to_here:"Largue os blocos aqui",msg_parson_correct_first_try:"Perfeito! Você levou apenas uma tentativa para resolver. Bom trabalho!",msg_parson_correct:"Perfeito! Você levou $1 tentativas para resolver. Clique em Resetar para tentar resolver em uma tentativa.",msg_parson_wrong_indent:"Este bloco não está indentado corretamente. Indente mais arrastando-o para a direita ou reduza a indentação arrastando para a esquerda.",msg_parson_wrong_indents:"Estes blocos não estão indentados corretamente. Para indentar mais, arraste o bloco para a direita. Para reduzir a indentação, arraste para a esquerda.",msg_parson_wrong_order:"Blocos destacados no seu programa estão errados ou estão na ordem errada. Isso pode ser resolvido movendo, excluindo ou substituindo os blocos destacados.",msg_parson_arrow_navigate:"Use as teclas de setas para navegar. Espaço para selecionar/ desmarcar blocos para mover.",msg_parson_help_info:"Clique no botão Ajuda se você quiser facilitar o problema",msg_parson_not_solution:"Foi desabilitado um bloco de código desnecessário (que não faz parte da solução).",msg_parson_provided_indent:"Foi fornecida a indentação.",msg_parson_combined_blocks:"Dois blocos de códigos foram combinados em um.",msg_parson_remove_incorrect:"Será removido um bloco de código incorreto da área de resposta",msg_parson_will_combine:"Serão combinados dois blocos",msg_parson_atleast_three_attempts:"Você deve tentar pelo menos três vezes antes de pedir ajuda",msg_parson_three_blocks_left:"Restam apenas 3 blocos corretos. Você deve colocá-los em ordem",msg_parson_will_provide_indent:"Será fornecida a indentação"}})},75794:()=>{$.i18n().load({en:{msg_parson_check_me:"Check",msg_parson_reset:"Reset",msg_parson_help:"Help me",msg_parson_too_short:"Your answer is too short. Add more blocks.",msg_parson_drag_from_here:"Drag from here",msg_parson_drag_to_here:"Drop blocks here",msg_parson_correct_first_try:"Perfect! It took you only one try to solve this. Great job!",msg_parson_correct:"Perfect! It took you $1 tries to solve this. Click Reset to try to solve it in one attempt.",msg_parson_correct_runnable:"Click Run below to test out your solution.",msg_parson_wrong_indent:"This block is not indented correctly. Either indent it more by dragging it right or reduce the indention by dragging it left.",msg_parson_wrong_indents:"These blocks are not indented correctly. To indent a block more, drag it to the right. To reduce the indention, drag it to the left.",msg_parson_wrong_order:"Highlighted blocks in your answer are wrong or are in the wrong order. This can be fixed by moving, removing, or replacing highlighted blocks.",msg_parson_arrow_navigate:"Arrow keys to navigate. Space to select / deselect block to move.",msg_parson_help_info:"Click on the Help Me button if you want to make the problem easier",msg_parson_not_solution:"Disabled an unneeded code block (one that is not part of the solution).",msg_parson_provided_indent:"Provided the indentation.",msg_parson_combined_blocks:"Combined two code blocks into one.",msg_parson_remove_incorrect:"Will remove an incorrect code block from answer area",msg_parson_will_combine:"Will combine two blocks",msg_parson_atleast_three_attempts:"You must make at least three distinct full attempts at a solution before you can get help",msg_parson_three_blocks_left:"There are only 3 correct blocks left. You should be able to put them in order",msg_parson_will_provide_indent:"Will provide indentation"}})},78811:()=>{function e(){var t=navigator&&navigator.userAgent&&/\bMSIE 6\./.test(navigator.userAgent);return e=function(){return t},t}!function(){var t="break continue do else for if return while ",i=t+"auto case char const default double enum extern float goto int long register short signed sizeof static struct switch typedef union unsigned void volatile catch class delete false import new operator private protected public this throw true try ",s=i+"alignof align_union asm axiom bool concept concept_map const_cast constexpr decltype dynamic_cast explicit export friend inline late_check mutable namespace nullptr reinterpret_cast static_assert static_cast template typeid typename typeof using virtual wchar_t where ",n=i+"boolean byte extends final finally implements import instanceof null native package strictfp super synchronized throws transient ",r=i+"debugger eval export function get null set undefined var with Infinity NaN ",o="caller delete die do dump elsif eval exit foreach for goto if import last local my next no our print package redo require sub undef unless until use wantarray while BEGIN END ",a=t+"and as assert class def del elif except exec finally from global import in is lambda nonlocal not or pass print raise try with yield False True None ",l=t+"alias and begin case class def defined elsif end ensure false in module next nil not or redo rescue retry self super then true undef unless until when yield BEGIN END ",h=t+"case done elif esac eval fi function in local set then until ",c=s+(n+"as base by checked decimal delegate descending event fixed foreach from group implicit in interface internal into is lock object out override orderby params readonly ref sbyte sealed stackalloc string select uint ulong unchecked unsafe ushort var ")+r+o+a+l+h;function d(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function u(e,t,i,s){e.unshift(i,s||0);try{t.splice.apply(t,e)}finally{e.splice(0,2)}}var p=function(){for(var e=["!","!=","!==","#","%","%=","&","&&","&&=","&=","(","*","*=","+=",",","-=","->","/","/=",":","::",";","<","<<","<<=","<=","=","==","===",">",">=",">>",">>=",">>>",">>>=","?","@","[","^","^=","^^","^^=","{","|","|=","||","||=","~","break","case","continue","delete","do","else","finally","instanceof","return","throw","try","typeof"],t="(?:(?:(?:^|[^0-9.])\\.{1,3})|(?:(?:^|[^\\+])\\+)|(?:(?:^|[^\\-])-)",i=0;i:&])/g,"\\$1")}return t+="|^)\\s*$",new RegExp(t)}(),v=/&/g,g=//g,m=/\"/g;function b(e){return e.replace(v,"&").replace(g,"<").replace(f,">")}var w=/</g,k=/>/g,y=/'/g,$=/"/g,x=/&/g,_=/ /g;function C(e){var t=e.indexOf("&");if(t<0)return e;for(--t;(t=e.indexOf("&#",t+1))>=0;){var i=e.indexOf(";",t);if(i>=0){var s=e.substring(t+3,i),n=10;s&&"x"===s.charAt(0)&&(s=s.substring(1),n=16);var r=parseInt(s,n);isNaN(r)||(e=e.substring(0,t)+String.fromCharCode(r)+e.substring(i+1))}}return e.replace(w,"<").replace(k,">").replace(y,"'").replace($,'"').replace(x,"&").replace(_," ")}function I(e){return"XMP"===e.tagName}function A(e,t){switch(e.nodeType){case 1:var i=e.tagName.toLowerCase();t.push("<",i);for(var s=0;s");for(var r=e.firstChild;r;r=r.nextSibling)A(r,t);!e.firstChild&&/^(?:br|link|img)$/.test(i)||t.push("");break;case 2:t.push(e.name.toLowerCase(),'="',function(e){return e.replace(v,"&").replace(g,"<").replace(f,">").replace(m,""")}(e.value),'"');break;case 3:case 4:t.push(b(e.nodeValue))}}var S=null;function T(e){if(null===S){var t=document.createElement("PRE");t.appendChild(document.createTextNode('\n')),S=!/||<\/?[a-zA-Z][^>]*>|<)/g,B=/^ + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/backmatter.html b/backmatter.html index a4532c7..eb222f5 100755 --- a/backmatter.html +++ b/backmatter.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/ch-Confidence-Intervals.html b/ch-Confidence-Intervals.html index 489fdc1..de482db 100755 --- a/ch-Confidence-Intervals.html +++ b/ch-Confidence-Intervals.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -135,7 +135,7 @@ eBookConfig.enable_chatcodes = false; -PrevUpNext +PrevUpNext -
January 29, 2026
+
February 10, 2026
-PrevUpNext +PrevUpNext

-Section 4.1 Central Limit Theorem +Section 4.2 Central Limit Theorem

Text of section.
@@ -300,24 +307,24 @@ eBookConfig.enable_chatcodes = false;

1.

Suppose a coin has probability 0.4 of coming up heads, and we flip the coin 100 times. Let \(S\) be the number of heads. Estimate the probability that \(34 \leq S \leq 44\text{.}\)
-

2.

Suppose a fair die is rolled 100 times, and let \(m\) be the average value of the rolls. Estimate the probability that \(3.45 \leq m \leq 3.55\text{.}\)
-

3.

The heights of men in the US have a mean of 69 in and a variance of about 9 in\(^2\text{,}\) and the heights of women in the US have a mean of 63.5 in with a variance of 6.25 in\(^2\text{.}\)
(a)
Suppose the heights of 30 men are sampled, and a sample mean \(m\) is taken. Find the expected value and variance of \(m\text{.}\)
-
(b)
Estimate the probability that \(m \geq 69.5\text{.}\)
-
(c)
What if the sampled group was women?
-
+

-Section 4.2 Confidence Intervals +Section 4.3 Confidence Intervals

Text of section.
@@ -300,18 +307,18 @@ eBookConfig.enable_chatcodes = false;

1.

Suppose we flip a coin 100 times and count 60 heads. Let \(p\) be the (unknown) probability that the coin comes up heads on a flip. Give an approximate 95% confidence interval for the value of \(p\text{.}\)
-

2.

Suppose in a sample of 100 people, 12 are left-handed.
(a)
Give a 95% confidence interval for the proportion \(p\) of left-handed people.
-
(b)
Give a 90% confidence interval.
-

3.

The weights of five mice are measured and recorded below. Give a 95% confidence interval for the sample mean weight of mice. (Pretend 5 measurements is large enough for the CLT to apply.) -
Table 4.2.1.
+
Table 4.3.1.
@@ -329,9 +336,9 @@ eBookConfig.enable_chatcodes = false; -
mouse \(i\) 20 29

4.

+

4.

The heights of five plants are measured and recorded below. Give a 95% confidence interval around the sample mean for the heights of the plants. (Pretend 5 measurements is large enough for the CLT to apply.) -
Table 4.2.2.
+
Table 4.3.2.
@@ -349,7 +356,7 @@ eBookConfig.enable_chatcodes = false; -
plant \(i\) 21 17
+
diff --git a/sec-Continuous-RVs.html b/sec-Continuous-RVs.html index 363743b..6a4fcec 100755 --- a/sec-Continuous-RVs.html +++ b/sec-Continuous-RVs.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Correlation.html b/sec-Correlation.html index 5780b4e..90d1074 100755 --- a/sec-Correlation.html +++ b/sec-Correlation.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Covariance.html b/sec-Covariance.html index 6d9d7f4..f672825 100755 --- a/sec-Covariance.html +++ b/sec-Covariance.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Discrete-RVs.html b/sec-Discrete-RVs.html index 3c5a198..4b14c29 100755 --- a/sec-Discrete-RVs.html +++ b/sec-Discrete-RVs.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Example.html b/sec-Example.html new file mode 100755 index 0000000..40ff1aa --- /dev/null +++ b/sec-Example.html @@ -0,0 +1,392 @@ + + + + + + + + + + + + + + + + +Example + + + + + + + + + + + + + + + + + + + + +Skip to main content
+

Math 1044 Notes

+ +
+
+
+

+Section 4.4 Example +

+
Welcome to PreTeXt. Let’s type up some math. According to Pythagoras, \(a^2 + b^2 = c^2\text{.}\) But he also thought \(\sqrt{2}\) was rational, so maybe we shouldn’t take his word for it. Let’s see a proof by picture. +
+

Proof.

+Right triangle with squares appended to each side.
Right triangle with legs labeled \(a\) and \(b\) and hypotenuse labeled \(c\text{.}\) Squares are appended to each side of the triangle. +
+
+

+Definition 4.4.2. +

+
A real number \(x \in \R\) is called rational if there are integers \(a, b\) so that \(x = \frac{a}{b}\text{.}\) Otherwise, \(x\) is called irrational, no matter what Pythagoras says. +
+

+Example 4.4.3. +

+
+\(\frac{1}{2}\) is rational. +
+

+Example 4.4.4. +

+
Is \(\sqrt{2}\) rational? +
+
+
Hint 1.
+
Why does \(\pi = \frac{\sqrt{2}}{1}\) not show that \(\sqrt{2}\) is rational? +
+ +
Hint 2.
+
What would happen if you assumed \(\sqrt{2}\) is rational? +
+ +
Answer.
+
No! +
+ +
Solution.
+
+
Suppose that \(\sqrt{2} = \frac{a}{b}\) for relatively prime integers \(a, b\text{.}\) Then:
+
+\begin{align*} +2 \amp = \frac{a^2}{b^2}\\ +2b^2 \amp = a^2 +\end{align*} +
+
But, after taking the prime factorization of both sides, the left side has an odd number of prime factors and the right side has an even number. This is a contradiction, so \(\sqrt{2}\) is irrational.
+ +
+ +
+
+

+Exercise 4.4.5. +

Prove that \(\sqrt{3}\) is irrational. +
+

+Exercises Exercises +

+
+
+
+ + + diff --git a/sec-Expected-Value.html b/sec-Expected-Value.html index cac1349..3ca2cae 100755 --- a/sec-Expected-Value.html +++ b/sec-Expected-Value.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Independent-Events.html b/sec-Independent-Events.html index 0482d53..2f518dd 100755 --- a/sec-Independent-Events.html +++ b/sec-Independent-Events.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Introduction.html b/sec-Introduction.html index 68fc61c..fe4d24c 100755 --- a/sec-Introduction.html +++ b/sec-Introduction.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Joint-Distributions.html b/sec-Joint-Distributions.html index 2bcd100..52225c4 100755 --- a/sec-Joint-Distributions.html +++ b/sec-Joint-Distributions.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Likelihood.html b/sec-Likelihood.html new file mode 100755 index 0000000..403b412 --- /dev/null +++ b/sec-Likelihood.html @@ -0,0 +1,554 @@ + + + + + + + + + + + + + + + + +Likelihood + + + + + + + + + + + + + + + + + + + + +Skip to main content
+

Math 1044 Notes

+ +
+
+ +

+Section 4.1 Likelihood +

+
So far, we’ve been concerned with probability theory. Starting with a probability distribution and some parameter values, we’ve tried to answer questions like: What’s the probability of seeing certain experimental results? Statistics is concerned with going in the other direction: Upon seeing the experimental results, can we determine the type of underlying probability distribution? Can we determine its parameters? +
+

+Definition 4.1.1. +

+
An estimator is a value of a parameter computed from a sample of data. +
+

+Example 4.1.2. +

+
Suppose we find a coin on the street and don’t know whether or not it’s fair. We want to know the probability \(p\) of the coin coming up heads. We might, for example, flip the coin \(n\) times and count the number \(k\) of heads. Then, we’ll estimate \(p = \frac{k}{n}\text{.}\) We’ll refer to this as a common sense estimator. (Other distributions and parameter types will have different notions of "common sense".) +
+
An estimator is, itself, a random variable: it produces a numerical value based on the results of an experiment. We’ll use notation like \(\est{p}\) for a random variable which is an estimator for a parameter \(p\text{.}\) (Similarly, \(\est{\lambda}\) would denote an estimator for a parameter called \(\lambda\text{.}\)) +
+

+Definition 4.1.3. +

+
An estimator \(\est{p}\) is called unbiased if \(\E(\est{p}) = p\text{.}\) +
+

+Example 4.1.4. +

+
+
Suppose we have a coin with parameter \(p\text{,}\) which we’ll flip \(n\) times and count the number \(k\) of heads. We use the unbiased estimator \(\est{p} = \frac{k}{n}\text{.}\) In this case, notice that \(k \sim \Bin(n, p)\text{,}\) so we know \(\E(k) = np\text{,}\) although we don’t know the value of \(p\text{.}\) (We probably do know the value of \(n\text{;}\) after all, we’re flipping the coin!) Now:
+
+\begin{gather*} +\E(\est{p}) = \E\left(\frac{k}{n}\right) = \frac{1}{n} \cdot \E(k) = \frac{1}{n} \cdot np = p. +\end{gather*} +
+
It’s worth pausing for a moment to be appropriately impressed with ourselves. We still don’t know the true value of \(p\text{.}\) But we managed to show that our common sense method of estimating \(p\) gives, on average, the correct value.
+ +
+
We’d like to be able to collect some data and use that data to estimate the values of whatever parameters our distribution has. Perhaps as a starting point, it would be good to identify the single most likely value of a parameter: +
+

+Definition 4.1.5. +

+
+
Suppose we collect some data to estimate a parameter \(p\text{.}\) The likelihood function is:
+
+\begin{gather*} +\L(p) = \Pr(\text{data} \mid \text{parameter value is } p). +\end{gather*} +
+
The value of \(p\) which maximizes the function \(\L(p)\) is called the maximum likelihood estimation, or MLE, of \(p\text{.}\) +
+ +
+

+Example 4.1.6. +

+
+
Suppose we flip a coin 100 times. Let \(N\) be the number of heads. Then \(N\sim \Bin(100, p)\) for some unknown value of \(p\text{:}\) +
+
+\begin{align*} +\Pr(N = k) \amp = b(k; 100, p) = {100 \choose k} p^k (1 - p)^{100 - k} +\end{align*} +
+
In this case, \(k\) is the data that we collect, and \(p\) is the value of the parameter. Suppose we see \(52\) heads. Then:
+
+\begin{gather*} +\L(p) = {100 \choose 52} p^{52} (1 - p)^{48}. +\end{gather*} +
+
If we want to know the most likely value of the parameter \(p\text{,}\) then we should maximize \(\L(p)\) over the interval \(0 \leq p \leq 1\text{.}\) +
+
+\begin{align*} +\L'(p) \amp = {100 \choose 52} \left[ 52 p^{51}(1 - p)^{48} + p^{52} 48 (1 - p)^{47}(-1)\right] \\ +\amp = {100 \choose 52} p^{51} (1 - p)^{47} \left[ 52 (1 - p) - 48p \right] \\ +\amp = {100 \choose 52} p^{51} (1 - p)^{47} \left[ 52 - 100 p \right]. +\end{align*} +
+
We can see that \(\L'(p) = 0\) when \(p = 0, 1, \frac{52}{100}\text{,}\) and the endpoints of the interval we’re maximizing over are \(p = 0, 1\text{,}\) so we can build a table:
+ +
Table 4.1.7. Looking for the Maximum
+ + + + + + + + + + + + + + + + +
\(p\)\(\L(p)\)
\(0\)\(0\)
\(52/100\)\(\gt 0\)
\(1\)\(0\)
Note that we don’t need to know the exact value of \(\L(52/100)\) in order to see that it’s strictly positive, and therefore the maximum value of \(\L(p)\text{.}\) So, the MLE of \(p\) is \(52/100\text{.}\) +
+
We can see in the previous example that the MLE of \(p\) is also the common sense estimation of \(p\text{.}\) This will be the case in general for the binomial distribution, so we won’t need to redo this work over and over: +
+
As we remember from Calculus 1, maximizing a continuous function works slightly differently over a closed interval (like the previous example) or an open interval (like the next example). +
+

+Example 4.1.9. +

+
+
Suppose a radioactive material emits particles as it decays. Let \(N\) count the particles emitted. Then \(N \sim \Poiss(\lambda)\) for some unknown rate parameter \(\lambda\text{:}\) +
+
+\begin{gather*} +\Pr(N = k) = p(k; \lambda) = \frac{\lambda^k}{k!} e^{-\lambda} +\end{gather*} +
+
Suppose we observe a sample of material for 1 hour and count 8 particles emitted. Then:
+
+\begin{gather*} +\L(\lambda) = \frac{\lambda^8}{8!} e^{-\lambda} +\end{gather*} +
+
To maximize \(\L(\lambda)\) over the interval \(0 \lt \lambda \lt \infty\text{,}\) we start by finding critical points.
+
+\begin{align*} +\L'(\lambda) \amp = \frac{1}{8!} \left[ 8 \lambda^7 e^{-\lambda} + \lambda^8 e^{-\lambda} (-1)\right] \\ +\amp = \frac{1}{8!} \lambda^7 e^{-\lambda} \left[ 8 - e^{-\lambda} \right] +\end{align*} +
+
The only critical point is \(\lambda = 8\text{,}\) but we have not justified that this is the location of a global maximum. A critical point is only a potential location of a local minimum or maximum. But with a bit more justification: observe that \(\L'\) is positive on the interval \((0, 8)\) and negative on the interval \((8, \infty)\text{.}\) Therefore the function \(\L\) increases on \((0, 8)\) and decreases on \((8, \infty)\text{.}\) So it must reach its maximum at \(\lambda = 8\text{,}\) which is therefore the MLE.
+ +
+
As with the binomial distribution, the calculation will be essentially the same regardless of the specific number of particles observed, so: +
+
The situation for continuous random variables is similar, but slightly different. To build the likelihood function, we should use the pdf of the continuous random variable. So the likelihood function will give the probabiliy density given the data collected, rather than the probability itself. +
+

+Example 4.1.11. +

+
+
Suppose we observe a cell and measure the time \(T\) until a toxin molecule leaves the cell. Then \(T \sim \Exp(\lambda)\) for some unknown rate parameter \(\lambda\text{:}\) +
+
+\begin{gather*} +f(t) = \lambda e^{-\lambda t}. +\end{gather*} +
+
Suppose we observe a molecule leave the cell at \(t = 0.3\) minutes. Then:
+
+\begin{align*} +L(\lambda) \amp = \lambda e^{-0.3\lambda} \\ +L'(\lambda) \amp = e^{-0.3\lambda} + \lambda e^{-0.3t} (-0.3) \\ +\amp = e^{-0.3\lambda}\left[ 1 - 0.3\lambda\right] +\end{align*} +
+
The critical point is \(\lambda = \frac{1}{0.3} \approx 3.33\text{.}\) Since \(\L' \gt 0\) on \((0, 3.33)\) and \(\L' \lt 0\) on \((3.33, \infty)\text{,}\) there is a global maximum at \(\lambda \approx 3.33\text{,}\) which is therefore the MLE.
+ +
The specific time \(0.3\) minutes doesn’t particularly matter in this calculation. Whatever the time \(t\text{,}\) essentially the same calculation will result in a MLE of \(\lambda = 1/t\text{.}\) But what if we collect multiple pieces of data? +
Table 4.1.12. Time Data
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MoleculeWaiting TimeRate Estimation
1\(0.3\)\(3.33\)
2\(0.8\)\(1.25\)
3\(0.5\)\(2.00\)
4\(0.6\)\(1.67\)
5\(0.9\)\(1.11\)
How should take all of this data into account in our maximum likelihood estimation? We might consider taking the average of all of the separate rate estimations, which would give \(1.87\text{.}\) Is this the most likely? We need some mathematical justification. +
+
To account for multiple, independent data points, we should multiply the probability densities for each in the creation of our likelihood function:
+
+\begin{align*} +\L(\lambda) \amp = \left(\lambda e^{-0.3\lambda}\right)\left(\lambda e^{-0.8\lambda}\right)\left(\lambda e^{-0.5\lambda}\right)\left(\lambda e^{-0.6\lambda}\right)\left(\lambda e^{-0.9\lambda}\right) \\ +\amp = \lambda^5 e^{-0.3\lambda - 0.8\lambda - 0.5\lambda - 0.6\lambda - 0.9\lambda } \\ +\amp = \lambda^5 e^{-3.1\lambda} +\end{align*} +
+
Now we can find the maximum:
+
+\begin{align*} +\L'(\lambda) \amp = 5 \lambda^4 e^{-3.1\lambda} + \lambda^5 e^{-3.1\lambda} (-3.1) \\ +\amp = 5 \lambda^4 e^{-3.1\lambda} + \lambda^5 e^{-3.1\lambda} (-3.1) \\ +\amp = \lambda^4 e^{-3.1\lambda} \left[5 - 3.1\lambda \right] +\end{align*} +
+
The only critical point is \(5/3.1 \approx 1.61\text{.}\) Since \(\L' \gt 0\) on \((0, 1.61)\) and \(\L' \lt 0\) on \((1.61, \infty)\text{,}\) there is a global maximum at \(\lambda = 1.61\text{,}\) which is therefore the MLE.
+ +
It may seem less clear how to generalize this calculation for other tables of data. Observe that the value \(3.1\) is the sum of the five times in the table, so \(3.1/5\) is the average time. The MLE turned out to be the reciprocal of the average time (just as the MLE with only one data point was the reciprocal of that one time). Notice that this does not match the guess we made previously of averaging the individual rate estimations for each data point. +
+

+Exercises Exercises +

+

1.

+
Suppose a coin has an unknown probability of coming up heads. We perform the experiment in five independent trials, during which it takes 4, 5, 4, 3, and 6 flips to see our first heads in each trial. What is the maximum likelihood estimation for the probability of the coin coming up heads on a flip? +
+

2.

+
Suppose a coin has an unknown probability of coming up heads. We perform the experiment in \(n\) independent trials, during which it takes \(k_1, k_2, \dotsc, k_n\) flips to see our first heads in each trial. Find a "common sense" MLE formula for the geometric distribution. +
+
Hint.
+
You could set up a calculation analogous to Example 4.1.11. Or, you could consider Fact 4.1.8. +
+ +
+

3.

+
A particular store owner wants to approximate the average hourly rate at which customers come into the store. They observe 80 customers enter during a particular 4-hour shift. What is the maximum likelihood estimation for the hourly customer rate? +
+

4.

+
A radioactive material emits particles at an unknown probabilistic rate \(\lambda\) particles per minute. We observe particles emitted at times 1.1, 1.7, 1.3, 2.2, 1.9, and 1.8 minutes. Write the likelihood function \(\mathcal{L}(\lambda)\) based on this data. What is the maximum likelihood estimation for \(\lambda\text{?}\) +
+

5.

+
Suppose a parameter \(\theta\) takes values in \([0, 1]\) with likelihood function \(\mathcal{L}(\theta) = \sqrt{\theta} - \theta^2\text{.}\) Find the maximum likelihood estimation of \(\theta\text{.}\) +
+
+
+
+ + + diff --git a/sec-Linear-Regression.html b/sec-Linear-Regression.html index 46dbc4a..552c47a 100755 --- a/sec-Linear-Regression.html +++ b/sec-Linear-Regression.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-One-Sample-Tests.html b/sec-One-Sample-Tests.html index 2dde7ff..6ab3d81 100755 --- a/sec-One-Sample-Tests.html +++ b/sec-One-Sample-Tests.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Power.html b/sec-Power.html index 041ad00..a42a5d5 100755 --- a/sec-Power.html +++ b/sec-Power.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Probability.html b/sec-Probability.html index 777c709..26f94b1 100755 --- a/sec-Probability.html +++ b/sec-Probability.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Set-Theory.html b/sec-Set-Theory.html index f3b93d1..fce0a2d 100755 --- a/sec-Set-Theory.html +++ b/sec-Set-Theory.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Two-Sample-Tests.html b/sec-Two-Sample-Tests.html index d59d4bb..fba228c 100755 --- a/sec-Two-Sample-Tests.html +++ b/sec-Two-Sample-Tests.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false; diff --git a/sec-Variance.html b/sec-Variance.html index fae702a..b52abae 100755 --- a/sec-Variance.html +++ b/sec-Variance.html @@ -62,7 +62,7 @@ window.MathJax = { "[pretext]/mathjaxknowl3.js" ], "paths": { - "pretext": "_static/pretext/js/lib" + "pretext": "_static/pretext/js" } }, "startup": { @@ -79,7 +79,7 @@ window.MathJax = { - + @@ -101,16 +101,16 @@ eBookConfig.allow_pairs = false; eBookConfig.enableScratchAC = false; eBookConfig.build_info = ""; eBookConfig.python3 = null; -eBookConfig.runestone_version = '7.11.11'; +eBookConfig.runestone_version = '7.11.13'; eBookConfig.jobehost = ''; eBookConfig.proxyuri_runs = ''; eBookConfig.proxyuri_files = ''; eBookConfig.enable_chatcodes = false; - + - @@ -151,6 +151,9 @@ eBookConfig.enable_chatcodes = false; \DeclareMathOperator{\E}{E} \DeclareMathOperator{\Var}{Var} \DeclareMathOperator{\Cov}{Cov} +\newcommand{\L}{\mathcal{L}} + +\newcommand{\est}{\widehat} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} @@ -244,12 +247,16 @@ eBookConfig.enable_chatcodes = false;