Skip to content

Commit

Permalink
possibly fixed the twitter card issue
Browse files Browse the repository at this point in the history
  • Loading branch information
djnavarro committed Dec 31, 2018
1 parent bcbdc68 commit 8aeeb95
Show file tree
Hide file tree
Showing 70 changed files with 3,899 additions and 414 deletions.
9 changes: 1 addition & 8 deletions bookdown/_book/anova.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
<!-- add the twitter card and open graph tags -->
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@djnavarro">
<meta property="og:url" content="https://learningstatisticswithr.com">
<meta property="og:title" content="Learning Statistics with R">
<meta property="og:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">
<meta name="twitter:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">

<!-- ###### end inserted header ##### -->

Expand Down Expand Up @@ -907,12 +906,6 @@ <h2><span class="header-section-number">14.1</span> An illustrative data set</h2
)</code></pre></div>
<p>The results are shown in Figure <a href="anova.html#fig:moodgain">14.1</a>, which plots the average mood gain for all three conditions; error bars show 95% confidence intervals. As the plot makes clear, there is a larger improvement in mood for participants in the Joyzepam group than for either the Anxifree group or the placebo group. The Anxifree group shows a larger mood gain than the control group, but the difference isn’t as large.</p>
<p>The question that we want to answer is: are these difference “real”, or are they just due to chance?</p>
<pre><code>## Warning: package &#39;gplots&#39; was built under R version 3.5.2</code></pre>
<pre><code>##
## Attaching package: &#39;gplots&#39;</code></pre>
<pre><code>## The following object is masked from &#39;package:stats&#39;:
##
## lowess</code></pre>
<div class="figure"><span id="fig:moodgain"></span>
<img src="lsr_files/figure-html/moodgain-1.png" alt="Average mood gain as a function of drug administered. Error bars depict 95% confidence intervals associated with each of the group means." width="672" />
<p class="caption">
Expand Down
6 changes: 2 additions & 4 deletions bookdown/_book/anova2.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
<!-- add the twitter card and open graph tags -->
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@djnavarro">
<meta property="og:url" content="https://learningstatisticswithr.com">
<meta property="og:title" content="Learning Statistics with R">
<meta property="og:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">
<meta name="twitter:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">

<!-- ###### end inserted header ##### -->

Expand Down Expand Up @@ -2124,8 +2123,7 @@ <h3><span class="header-section-number">16.7.4</span> Viewing and setting the de
<p>These are the same treatment contrast that we set up manually in Section <a href="anova2.html#anovalm">16.6</a>. How did R know to set up treatment contrasts, even though I never actually told it anything about what contrasts I wanted? The answer is that R has a hidden list of default “options” that it looks up to resolve situations like this. You can print out all of the options by typing <code>options()</code> at the command prompt, but it’s not a very enlightening read. There are a lot of options, and we’re only interested in contrasts right now. Instead of printing out all of the options, we can ask for just one, like this:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"> <span class="kw">options</span>( <span class="st">&quot;contrasts&quot;</span> )</code></pre></div>
<pre><code>## $contrasts
## unordered ordered
## &quot;contr.treatment&quot; &quot;contr.poly&quot;</code></pre>
## [1] &quot;contr.treatment&quot; &quot;contr.poly&quot;</code></pre>
<p>What this is telling us is that the default contrasts for unordered factors (i.e., nominal scale variables) are treatment contrasts, and the default for ordered factors (i.e., interval scale variables) are “polynomial” contrasts. I don’t discuss ordered factors much in this book, and so I won’t go into what polynomial contrasts are all about. The key thing is that the <code>options()</code> function also allows you to reset these defaults (though only for the current session: they’ll revert to the original settings once you close R). Here’s the command:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"> <span class="kw">options</span>(<span class="dt">contrasts =</span> <span class="kw">c</span>(<span class="st">&quot;contr.helmert&quot;</span>, <span class="st">&quot;contr.poly&quot;</span>))</code></pre></div>
<p>Once we’ve done this, we can inspect the contrast settings again:</p>
Expand Down
15 changes: 3 additions & 12 deletions bookdown/_book/bayes.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
<!-- add the twitter card and open graph tags -->
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@djnavarro">
<meta property="og:url" content="https://learningstatisticswithr.com">
<meta property="og:title" content="Learning Statistics with R">
<meta property="og:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">
<meta name="twitter:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">

<!-- ###### end inserted header ##### -->

Expand Down Expand Up @@ -1365,16 +1364,8 @@ <h3><span class="header-section-number">17.6.2</span> The Bayesian test</h3>
<li><strong>Nothing is fixed</strong>. Finally, it might be the case that <em>nothing</em> is fixed. Not the row columns, not the column totals, and not the total sample size either. For instance, in the <code>chapek9</code> scenario, suppose what I’d done is run the study for a fixed length of <em>time</em>. By chance, it turned out that I got 180 people to turn up to study, but it could easily have been something else. This is referred to as “Poisson” sampling, and if that’s what you’ve done you should specify <code>sampleType=&quot;poisson&quot;</code>.</li>
</ul>
<p>Okay, so now we have enough knowledge to actually run a test. For the <code>chapek9</code> data, I implied that we designed the study such that the total sample size <span class="math inline">\(N\)</span> was fixed, so we should set <code>sampleType = &quot;jointMulti&quot;</code>. The command that we need is,</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>( BayesFactor )</code></pre></div>
<pre><code>## Warning: package &#39;BayesFactor&#39; was built under R version 3.5.2</code></pre>
<pre><code>## Loading required package: coda</code></pre>
<pre><code>## Loading required package: Matrix</code></pre>
<pre><code>## ************
## Welcome to BayesFactor 0.9.12-4.2. If you have questions, please contact Richard Morey ([email protected]).
##
## Type BFManual() to open the manual.
## ************</code></pre>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">contingencyTableBF</span>( crosstab, <span class="dt">sampleType =</span> <span class="st">&quot;jointMulti&quot;</span> )</code></pre></div>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">library</span>( BayesFactor )
<span class="kw">contingencyTableBF</span>( crosstab, <span class="dt">sampleType =</span> <span class="st">&quot;jointMulti&quot;</span> )</code></pre></div>
<pre><code>## Bayes factor analysis
## --------------
## [1] Non-indep. (a=1) : 15.92684 ±0%
Expand Down
3 changes: 1 addition & 2 deletions bookdown/_book/chisquare.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
<!-- add the twitter card and open graph tags -->
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@djnavarro">
<meta property="og:url" content="https://learningstatisticswithr.com">
<meta property="og:title" content="Learning Statistics with R">
<meta property="og:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">
<meta name="twitter:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">

<!-- ###### end inserted header ##### -->

Expand Down
17 changes: 9 additions & 8 deletions bookdown/_book/datahandling.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
<!-- add the twitter card and open graph tags -->
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@djnavarro">
<meta property="og:url" content="https://learningstatisticswithr.com">
<meta property="og:title" content="Learning Statistics with R">
<meta property="og:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">
<meta name="twitter:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">

<!-- ###### end inserted header ##### -->

Expand Down Expand Up @@ -2682,12 +2681,14 @@ <h3><span class="header-section-number">7.12.3</span> An introduction to environ
</div>
<p>In this section I want to ask a slightly different question: what <em>is</em> the workspace exactly? This question seems simple, but there’s a fair bit to it. This section can be skipped if you’re not really interested in the technical details. In the description I gave earlier, I talked about the workspace as an abstract location in which R variables are stored. That’s basically true, but it hides a couple of key details. For example, any time you have R open, it has to store <em>lots</em> of things in the computer’s memory, not just your variables. For example, the <code>who()</code> function that I wrote has to be stored in memory somewhere, right? If it weren’t I wouldn’t be able to use it. That’s pretty obvious. But equally obviously it’s not in the workspace either, otherwise you should have seen it! Here’s what’s happening. R needs to keep track of a lot of different things, so what it does is organise them into <strong><em>environments</em></strong>, each of which can contain lots of different variables and functions. Your workspace is one such environment. Every package that you have loaded is another environment. And every time you call a function, R briefly creates a temporary environment in which the function itself can work, which is then deleted after the calculations are complete. So, when I type in <code>search()</code> at the command line</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">search</span>()</code></pre></div>
<pre><code>## [1] &quot;.GlobalEnv&quot; &quot;package:HistData&quot; &quot;package:MASS&quot;
## [4] &quot;package:lsr&quot; &quot;package:psych&quot; &quot;package:car&quot;
## [7] &quot;package:carData&quot; &quot;tools:rstudio&quot; &quot;package:stats&quot;
## [10] &quot;package:graphics&quot; &quot;package:grDevices&quot; &quot;package:utils&quot;
## [13] &quot;package:datasets&quot; &quot;package:methods&quot; &quot;Autoloads&quot;
## [16] &quot;package:base&quot;</code></pre>
<pre><code>## [1] &quot;.GlobalEnv&quot; &quot;package:BayesFactor&quot; &quot;package:Matrix&quot;
## [4] &quot;package:coda&quot; &quot;package:effects&quot; &quot;package:lmtest&quot;
## [7] &quot;package:zoo&quot; &quot;package:gplots&quot; &quot;package:sciplot&quot;
## [10] &quot;package:HistData&quot; &quot;package:MASS&quot; &quot;package:lsr&quot;
## [13] &quot;package:psych&quot; &quot;package:car&quot; &quot;package:carData&quot;
## [16] &quot;tools:rstudio&quot; &quot;package:stats&quot; &quot;package:graphics&quot;
## [19] &quot;package:grDevices&quot; &quot;package:utils&quot; &quot;package:datasets&quot;
## [22] &quot;package:methods&quot; &quot;Autoloads&quot; &quot;package:base&quot;</code></pre>
<p>what I’m actually looking at is a <em>sequence of environments</em>. The first one, <code>&quot;.GlobalEnv&quot;</code> is the technically-correct name for your workspace. No-one really calls it that: it’s either called the workspace or the global environment. And so when you type in <code>objects()</code> or <code>who()</code> what you’re really doing is listing the contents of <code>&quot;.GlobalEnv&quot;</code>. But there’s no reason why we can’t look up the contents of these other environments using the <code>objects()</code> function (currently <code>who()</code> doesn’t support this). You just have to be a bit more explicit in your command. If I wanted to find out what is in the <code>package:stats</code> environment (i.e., the environment into which the contents of the <code>stats</code> package have been loaded), here’s what I’d get</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">head</span>(<span class="kw">objects</span>(<span class="st">&quot;package:stats&quot;</span>))</code></pre></div>
<pre><code>## [1] &quot;acf&quot; &quot;acf2AR&quot; &quot;add.scope&quot; &quot;add1&quot; &quot;addmargins&quot;
Expand Down
3 changes: 1 addition & 2 deletions bookdown/_book/dedication.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
<!-- add the twitter card and open graph tags -->
<meta name="twitter:card" content="summary">
<meta name="twitter:creator" content="@djnavarro">
<meta property="og:url" content="https://learningstatisticswithr.com">
<meta property="og:title" content="Learning Statistics with R">
<meta property="og:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">
<meta name="twitter:image" content="http://learningstatisticswithr.com/images/jasmine-faint.jpg">

<!-- ###### end inserted header ##### -->

Expand Down
Loading

0 comments on commit 8aeeb95

Please sign in to comment.