Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jtleek committed May 28, 2014
2 parents 0f6ee1f + e34f68e commit 72d6772
Show file tree
Hide file tree
Showing 1,382 changed files with 55,657 additions and 6,194 deletions.
4 changes: 2 additions & 2 deletions 01_DataScientistToolbox/03_04_experimentalDesign/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ <h2>Randomization and blocking</h2>
<li>If you can (and want to) fix a variable

<ul>
<li>Website always says Obama 2014 on it</li>
<li>Website always says Obama 2012 on it</li>
</ul></li>
<li>If you don&#39;t fix a variable, stratify it

Expand Down Expand Up @@ -521,4 +521,4 @@ <h2>Summary</h2>
<script>hljs.initHighlightingOnLoad();</script>
<!-- DONE LOADING HIGHLIGHTER JS FILES -->

</html>
</html>
Binary file modified 02_RProgramming/lectures/CodingStandard.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/ControlStructures.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/DataTypes.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/Dates.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/OverviewHistoryR.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/Scoping.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/Subsetting.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/Vectorized.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/apply.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/debugging.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/functions.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/help.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/lapply.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/mapply.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/profiler.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/reading_data_I.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/reading_data_II.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/simulation.pdf
Binary file not shown.
Binary file added 02_RProgramming/lectures/split.pdf
Binary file not shown.
Binary file modified 02_RProgramming/lectures/tapply.pdf
Binary file not shown.
Empty file.
14 changes: 14 additions & 0 deletions 04_ExploratoryAnalysis/assets/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
strong, b {
font-weight: bolder;
}
em {
font-style: italic;
}

img.center {
display: block;
margin: auto auto;
}
redtext {
color: red;
}
50 changes: 50 additions & 0 deletions 04_ExploratoryAnalysis/assets/css/ribbons.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*Github Ribbon Test*/
/* Source: https://github.com/dciccale/css3-github-ribbon */
/* Define classes for example, definition, problem etc. */
/* Choose meaningful colors for background and text */

.example {
background-color: #121621;
top: 1.2em;
right: -3.2em;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-box-shadow: 0 0 0 1px #1d212e inset,0 0 2px 1px #fff inset,0 0 1em #888;
-moz-box-shadow: 0 0 0 1px #1d212e inset,0 0 2px 1px #fff inset,0 0 1em #888;
box-shadow: 0 0 0 1px #1d212e inset,0 0 2px 1px #fff inset,0 0 1em #888;
color: #FF0;
display: block;
padding: .6em 3.5em;
position: absolute;
font: bold .82em sans-serif;
text-align: center;
text-decoration: none;
text-shadow: 1px -1px 8px rgba(0,0,0,0.60);
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}

.definition {
background-color: #a00;
top: 1.2em;
right: -3.2em;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
transform: rotate(45deg);
-webkit-box-shadow: 0 0 0 1px #1d212e inset,0 0 2px 1px #fff inset,0 0 1em #888;
-moz-box-shadow: 0 0 0 1px #1d212e inset,0 0 2px 1px #fff inset,0 0 1em #888;
box-shadow: 0 0 0 1px #1d212e inset,0 0 2px 1px #fff inset,0 0 1em #888;
color: #FFF;
display: block;
padding: .6em 3.5em;
position: absolute;
font: bold .82em sans-serif;
text-align: center;
text-decoration: none;
text-shadow: 1px -1px 8px rgba(0,0,0,0.60);
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
Empty file.
Binary file added 04_ExploratoryAnalysis/assets/img/bigdata.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/bigdata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/brain.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/census2010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/chrome.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/clinical.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/color2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/color3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/datacenter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/deluge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/example10.pdf
Binary file not shown.
Binary file added 04_ExploratoryAnalysis/assets/img/example10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/excel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/fastq.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/feces.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/final.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/fmri.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/fuelband.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/graph1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/graph2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 04_ExploratoryAnalysis/assets/img/hiseq.jpg
Binary file added 04_ExploratoryAnalysis/assets/img/hist1.png
Binary file added 04_ExploratoryAnalysis/assets/img/howmuch.png
Binary file added 04_ExploratoryAnalysis/assets/img/ibm350.jpg
Binary file added 04_ExploratoryAnalysis/assets/img/leskovec.jpg
Binary file added 04_ExploratoryAnalysis/assets/img/leskovec.png
Binary file added 04_ExploratoryAnalysis/assets/img/like1.png
Binary file added 04_ExploratoryAnalysis/assets/img/like2.png
Binary file added 04_ExploratoryAnalysis/assets/img/logo.gif
Binary file added 04_ExploratoryAnalysis/assets/img/meyer.jpg
Binary file added 04_ExploratoryAnalysis/assets/img/milgram.jpg
Binary file added 04_ExploratoryAnalysis/assets/img/ngrams.png
Binary file added 04_ExploratoryAnalysis/assets/img/openintro.png
Binary file added 04_ExploratoryAnalysis/assets/img/plot1.png
Binary file added 04_ExploratoryAnalysis/assets/img/plot2.png
Binary file added 04_ExploratoryAnalysis/assets/img/plot4.png
Binary file added 04_ExploratoryAnalysis/assets/img/plot5.png
Binary file added 04_ExploratoryAnalysis/assets/img/plot6.png
Binary file added 04_ExploratoryAnalysis/assets/img/poisson.png
Binary file added 04_ExploratoryAnalysis/assets/img/pollution.png
Binary file added 04_ExploratoryAnalysis/assets/img/processing.png
Binary file added 04_ExploratoryAnalysis/assets/img/raw.png
Binary file added 04_ExploratoryAnalysis/assets/img/readme.png
Binary file added 04_ExploratoryAnalysis/assets/img/restaurant.png
Binary file added 04_ExploratoryAnalysis/assets/img/rmarkdown.png
Binary file added 04_ExploratoryAnalysis/assets/img/rmd.png
Binary file added 04_ExploratoryAnalysis/assets/img/scatter1.png
Binary file added 04_ExploratoryAnalysis/assets/img/scatter2.png
Binary file added 04_ExploratoryAnalysis/assets/img/security.png
Binary file added 04_ExploratoryAnalysis/assets/img/sloan.png
Binary file added 04_ExploratoryAnalysis/assets/img/spamR.png
Binary file added 04_ExploratoryAnalysis/assets/img/swfdr.png
Binary file added 04_ExploratoryAnalysis/assets/img/target.jpg
Binary file added 04_ExploratoryAnalysis/assets/img/target.png
Binary file added 04_ExploratoryAnalysis/assets/img/triangle.png
Binary file added 04_ExploratoryAnalysis/assets/img/twitter.png
Binary file added 04_ExploratoryAnalysis/assets/img/uci.png
Binary file added 04_ExploratoryAnalysis/assets/img/where.pptx
Binary file not shown.
Empty file.
Empty file.
Binary file modified 04_ExploratoryAnalysis/lectures/GraphicsDevices.pdf
Binary file not shown.
Binary file modified 04_ExploratoryAnalysis/lectures/PlottingBase.pdf
Binary file not shown.
Binary file modified 04_ExploratoryAnalysis/lectures/PlottingLattice.pdf
Binary file not shown.
Binary file modified 04_ExploratoryAnalysis/lectures/PlottingSystems.pdf
Binary file not shown.
Binary file modified 04_ExploratoryAnalysis/lectures/Principles.pdf
Binary file not shown.
Binary file added 04_ExploratoryAnalysis/lectures/RColors.pdf
Binary file not shown.
Binary file modified 04_ExploratoryAnalysis/lectures/clusteringExample.pdf
Binary file not shown.
Binary file modified 04_ExploratoryAnalysis/lectures/dimensionReduction.pdf
Binary file not shown.
Binary file modified 04_ExploratoryAnalysis/lectures/exploratoryGraphs.pdf
Binary file not shown.
Binary file modified 04_ExploratoryAnalysis/lectures/hierachicalClustering.pdf
Binary file not shown.
Binary file modified 04_ExploratoryAnalysis/lectures/kmeansClustering.pdf
Binary file not shown.
Binary file modified 05_ReproducibleResearch/lectures/Checklist.pdf
Binary file not shown.
Binary file modified 05_ReproducibleResearch/lectures/EvidenceBasedDataAnalysis.pdf
Binary file not shown.
Binary file modified 05_ReproducibleResearch/lectures/LevelsOfDetail.pdf
Binary file not shown.
Binary file modified 05_ReproducibleResearch/lectures/Markdown.pdf
Binary file not shown.
Binary file modified 05_ReproducibleResearch/lectures/RMarkdown.pdf
Binary file not shown.
Binary file added 05_ReproducibleResearch/lectures/RRCaseStudy.pdf
Binary file not shown.
Binary file added 05_ReproducibleResearch/lectures/baggerly.pdf
Binary file not shown.
Binary file modified 05_ReproducibleResearch/lectures/organizingADataAnalysis.pdf
Binary file not shown.
Binary file not shown.
Binary file modified 05_ReproducibleResearch/lectures/structureOfADataAnalysis2.pdf
Binary file not shown.
Empty file.
187 changes: 187 additions & 0 deletions 06_StatisticalInference/homework/hw1.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
title : Homework 1 for Stat Inference
subtitle : Extra problems for Stat Inference
author : Brian Caffo
job : Johns Hopkins Bloomberg School of Public Health
framework : io2012
highlighter : highlight.js
hitheme : tomorrow
#url:
# lib: ../../librariesNew #Remove new if using old slidify
# assets: ../../assets
widgets : [mathjax, quiz, bootstrap]
mode : selfcontained # {standalone, draft}
---
```{r setup, cache = F, echo = F, message = F, warning = F, tidy = F, results='hide'}
# make this an external chunk that can be included in any file
library(knitr)
options(width = 100)
opts_chunk$set(message = F, error = F, warning = F, comment = NA, fig.align = 'center', dpi = 100, tidy = F, cache.path = '.cache/', fig.path = 'fig/')
options(xtable.type = 'html')
knit_hooks$set(inline = function(x) {
if(is.numeric(x)) {
round(x, getOption('digits'))
} else {
paste(as.character(x), collapse = ', ')
}
})
knit_hooks$set(plot = knitr:::hook_plot_html)
runif(1)
```

## About these slides
- These are some practice problems for Statistical Inference Quiz 1
- They were created using slidify interactive which you will learn in
Creating Data Products
- Please help improve this with pull requests here
(https://github.com/bcaffo/courses)


--- &radio

Consider influenza epidemics for two parent heterosexual families. Suppose that the probability is 15% that at least one of the parents has contracted the disease. The probability that the father has contracted influenza is 6% while that the mother contracted the disease is 5%. What is the probability that both contracted influenza expressed as a whole number percentage?

1. 15%
2. 6%
3. 5%
4. _2%_

*** .hint
$A = Father$, $P(A) = .06$, $B = Mother$, $P(B) = .05$
$P(A\cup B) = .15$,

*** .explanation
$P(A\cup B) = P(A) + P(B) - 2 P(AB)$ thus
$$.15 = .06 + .05 - 2 P(AB)$$
```{r}
(0.15 - .06 - .05) / 2
```

--- &radio

A random variable, $X$, is uniform, a box from $0$ to $1$ of height $1$. (So that it's density is $f(x) = 1$ for $0\leq x \leq 1$.) What is it's median expressed to two decimal places? </p>

1. 1.00
2. 0.75
3. _0.50_
4. 0.25

*** .hint
The median is the point so that 50% of the density lies below it.

*** .explanation
This density looks like a box. So, notice that $P(X \leq x) = width\times height = x$.
We want $.5 = P(X\leq x) = x$.

--- &radio

You are playing a game with a friend where you flip a coin and if it comes up heads you give her $X$ dollars and if it comes up tails she gives you $Y$ dollars. The odds that the coin is heads in $d$. What is your expected earnings?

1. _$-X \frac{d}{1 + d} + Y \frac{1}{1+d} $_
2. $X \frac{d}{1 + d} + Y \frac{1}{1+d} $
3. $X \frac{d}{1 + d} - Y \frac{1}{1+d} $
4. $-X \frac{d}{1 + d} - Y \frac{1}{1+d} $

*** .hint
The probability that you win on a given round is given by $p / (1 - p) = d$ which implies
that $p = d / (1 + d)$.

*** .explanation
You lose $X$ with probability $p = d/(1 +d)$ and you win $Y$ with probability $1-p = 1/(1 + d)$. So your answer is
$$
-X \frac{d}{1 + d} + Y \frac{1}{1+d}
$$

--- &radio
A random variable takes the value -4 with probabability .2 and 1 with proabability .8. What
is the variance of this random variable?

1. 0
2. _4_
3. 8
4. 16

*** .hint
This random variable has mean 0. The variance would be given by $E[X^2]$ then.

*** .explanation
$$E[X] = 0$$
$$
Var(X) = E[X^2] = (-4)^2 * .2 + (1)^2 * .8
$$
```{r}
-4 * .2 + 1 * .8
(-4)^2 * .2 + (1)^2 * .8
```


--- &radio
If $\bar X$ and $\bar Y$ are comprised of $n$ iid random variables arising from distributions
having means $\mu_x$ and $\mu_y$, respectively and common variance $\sigma^2$
what is the variance $\bar X - \bar Y$?

1. 0
2. _$2\sigma^2/n$_
3. $\mu_x$ - $\mu_y$
4. $2\sigma^2$

*** .hint
Remember that $Var(\bar X) = Var(\bar Y) = \sigma^2 / n$.

*** .explanation
$$
Var(\bar X - \bar Y) = Var(\bar X) + Var(\bar Y) = \sigma^2 / n + \sigma^2 / n
$$

--- &radio
Let $X$ be a random variable having standard deviation $\sigma$. What can
be said about $X /\sigma$?

1. Nothing
2. _It must have variance 1._
3. It must have mean 0.
4. It must have variance 0.

*** .hint
$Var(aX) = a^2 Var(X)$

*** .explanation
$$Var(X / \sigma) = Var(X) / \sigma^2 = 1$$


--- &radio
If a continuous density that never touches the horizontal axis is symmetric about zero, can we say that its associated median is zero?

1. _Yes_
2. No.
3. It can not be determined given the information given.

*** .explanation
This is a surprisingly hard problem. The easy explanation is that 50% of the probability
is below 0 and 50% is above so yes. However, it is predicated on the density not being
a flat line at 0 around 0. That's why the caveat that it never touches the horizontal axis
is important.


--- &radio

Consider the following pmf given in R
```{r}
p <- c(.1, .2, .3, .4)
x <- 2 : 5
```
What is the variance expressed to 1 decimal place?

1. _1.0_
2. 4.0
3. 6.0
4. 17.0

*** .hint
The variance is $E[X^2] - E[X^2]$

*** .explanation
```{r}
sum(x ^ 2 * p) - sum(x * p) ^ 2
```
Loading

0 comments on commit 72d6772

Please sign in to comment.