X-Git-Url: https://code.communitydata.science/stats_class_2019.git/blobdiff_plain/dbde6a6880af749afd92848e06128fe161159d0b..3289a7f15892ec730695fd7c9179156ae5d162ee:/problem_sets/week_03/ps3-worked_solution.html diff --git a/problem_sets/week_03/ps3-worked_solution.html b/problem_sets/week_03/ps3-worked_solution.html index 9927124..a909ded 100644 --- a/problem_sets/week_03/ps3-worked_solution.html +++ b/problem_sets/week_03/ps3-worked_solution.html @@ -464,7 +464,7 @@ w2.data <- log1p(w2.data)</code></pre> <pre><code>## [1] 9.643215 2.158358 1.396595 0.192623 1.752234 0.170634</code></pre> <p>Inspecting the first few values returned by <code>head()</code> gave you a clue. Rounded to six decimal places, the vectors match!</p> <p>I can create a table comparing the sorted rounded values to check this.</p> -<pre class="r"><code>table(sort(round(w2.data, 6)) == sort(round(w3.data$x, 6)))</code></pre> +<pre class="r"><code>table(round(w2.data,6) == round(w3.data$x,6))</code></pre> <pre><code>## ## TRUE ## 95</code></pre> @@ -546,7 +546,7 @@ head(w3.data)</code></pre> ## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's ## -4.42 3.19 7.81 9.96 14.61 33.14 5</code></pre> <pre class="r"><code>### Run this line again to assign the new dataframe to p -p <- ggplot(w3.data, aes(x=x, y=y)) +p <- ggplot(data=w3.data, mapping=aes(x=x, y=y)) p + geom_point(aes(color=j, size=l, shape=k))</code></pre> <pre><code>## Warning: Using size for a discrete variable is not advised.</code></pre> @@ -641,7 +641,7 @@ l68/length(d)</code></pre> <ol start="4" style="list-style-type: lower-alpha"> <li>Is random assignment to tents likely to ensure <span class="math inline">\(\leq1~arachnophobe\)</span> per tent?</li> </ol> -<p>Random assignment and the independence assumption means that the answer to part c is the inverse of the outcome weâre looking to avoid: <span class="math inline">\(P(\gt1~arachnophobes) = 1-P(\leq1~arachnophobe)\)</span>. So, <span class="math inline">\(P(\gt1~arachnophobes) = 1-0.84 = 0.16 = 16\%\)</span>. Those are the probabilities, but the interpretation really depends on how confident the camp counselor feels about a <span class="math inline">\(16\%\)</span> chance of having multiple arachnophobic campers in one of the tents.</p> +<p>Random assignment and the independence assumption means that the answer to part c is the complement of the outcome weâre looking to avoid: <span class="math inline">\(P(\gt1~arachnophobes) = 1-P(\leq1~arachnophobe)\)</span>. So, <span class="math inline">\(P(\gt1~arachnophobes) = 1-0.84 = 0.16 = 16\%\)</span>. Those are the probabilities, but the interpretation really depends on how confident the camp counselor feels about a <span class="math inline">\(16\%\)</span> chance of having multiple arachnophobic campers in one of the tents.</p> </div> </div>