Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix small typo #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion book/ch-intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,7 @@ <h2><span class="header-section-number">1.4</span> Discrete random variables: An
<p><em>“It’s raining, I’m going to take the ….”</em></p>
<p>Suppose that our research goal is to estimate the probability, call it <span class="math inline">\(\theta\)</span>, of the word “umbrella” appearing in this sentence, versus any other word. If the sentence is completed with the word “umbrella”, we will refer to it as a success; any other completion will be referred to as a failure. This is an example of a binomial random variable: given <span class="math inline">\(n\)</span> trials, there can be only two possible outcomes in each trial, a success or a failure, and there is some true unknown probability <span class="math inline">\(\theta\)</span> of success that we want to estimate. When the number of trials is one, the random variable is said to have a Bernoulli distribution.</p>
<p>One way to empirically estimate this probability of success is to carry out a <em>cloze task</em>. In a cloze task, subjects are asked to complete a fragment of the original sentence, such as “It’s raining, I’m going to take the …”. The predictability or cloze probability of “umbrella” is then calculated as the proportion of times that the target word “umbrella” was produced as an answer by subjects.</p>
<p>Assume for simplicity that <span class="math inline">\(10\)</span> subjects are asked to complete the above sentence; each subject does this task only once. This gives us independent responses from <span class="math inline">\(10\)</span> trials that are either coded a success (“umbrella” was produced) or as a failure (some other word was produced). We can sum up the number of sucesses to calculate how many of the 10 trials had “umbrella” as a response. For example, if <span class="math inline">\(8\)</span> instances of “umbrella” are produced in <span class="math inline">\(10\)</span> trials, we would estimate the cloze probability of producing “umbrella” would be <span class="math inline">\(8/10\)</span>.</p>
<p>Assume for simplicity that <span class="math inline">\(10\)</span> subjects are asked to complete the above sentence; each subject does this task only once. This gives us independent responses from <span class="math inline">\(10\)</span> trials that are either coded a success (“umbrella” was produced) or as a failure (some other word was produced). We can sum up the number of successes to calculate how many of the 10 trials had “umbrella” as a response. For example, if <span class="math inline">\(8\)</span> instances of “umbrella” are produced in <span class="math inline">\(10\)</span> trials, we would estimate the cloze probability of producing “umbrella” would be <span class="math inline">\(8/10\)</span>.</p>
<p>We can repeatedly generate simulated sequences of the number of successes in <code>R</code> (later on we will demonstrate how to generate such random sequences of simulated data). Here is a case where we run the same experiment <span class="math inline">\(20\)</span> times (the sample size is <span class="math inline">\(10\)</span> each time).</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode r fold-show"><code class="sourceCode r"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="kw">rbinom</span>(<span class="dv">10</span>, <span class="dt">n =</span> <span class="dv">20</span>, <span class="dt">prob =</span> <span class="fl">0.5</span>)</a></code></pre></div>
<pre><code>## [1] 7 6 5 7 4 4 5 3 3 6 6 4 3 4 7 2 5 4 5 5</code></pre>
Expand Down