Petr Keil
February 2014
DAY 1
DAY 2
DAY 3
Statistical models are stories about how the data came to be.
\( \mu_i = a + b \times x_i \)
\( y_i \sim Normal(\mu_i, \sigma) \)
\( x_i \sim Normal(\mu, \sigma) \)
Let's use \( y \) for data, and \( \theta \) for parameters.
\( p(\theta | y, model) \) or \( p(y | \theta, model) \)
The model is always given (assumed), and it is usually omitted:
\( p(y|\theta) \) or \( p(\theta|y) \)
x <- c(2.3, 4.7, 2.1, 1.8, 0.2)
x
[1] 2.3 4.7 2.1 1.8 0.2
x[3]
[1] 2.1
X <- matrix(c(2.3, 4.7, 2.1, 1.8),
nrow=2, ncol=2)
X
[,1] [,2]
[1,] 2.3 2.1
[2,] 4.7 1.8
X[2,1]
[1] 4.7
x <- c(2.3, 4.7, 2.1, 1.8, 0.2)
N <- 5
data <- list(x=x, N=N)
data
$x
[1] 2.3 4.7 2.1 1.8 0.2
$N
[1] 5
data$x # indexing by name
[1] 2.3 4.7 2.1 1.8 0.2
for (i in 1:5)
{
statement <- paste("Iteration", i)
print(statement)
}
[1] "Iteration 1"
[1] "Iteration 2"
[1] "Iteration 3"
[1] "Iteration 4"
[1] "Iteration 5"