3 Random Processes
Today’s Learning Goals
- Understand mathematical notation used to describe the first and second moments of a sequence of random variables (random process).
- Construct a covariance matrix from a given autocovariance function.
- Generate correlated data from a given covariance matrix.
Slides from today are available here.
Group Activity
Download a template RMarkdown file to start from here.
Covariance Matrix
- Create a 3x3 symmetric covariance matrix that is “stationary” (constant variance over time and covariance is only a function of distance in time).
#Fill in the ? to satisfy the requirements above
rowOne <-c(?,?,?)
rowTwo <- c(?,?,?)
rowThree <- c(?,?,?)
D <- c(rowOne, rowTwo, rowThree)
(Sigma <- matrix(D, byrow=TRUE, nrow=3, ncol=3))- Make sure that the covariance matrix is positive semi-definite by trying the Cholesky Decomposition. If you get an error, go back to #1 and make sure that your covariance matrix satisfies the stated conditions (and the general conditions for variance and covariance).
#chol() gives you upper triangular matrix R such that Sigma = t(R) %*% R
L <- t(chol(Sigma)) # we want lower triangular matrix L such that Sigma = L %*% t(L)
L
L %*% t(L) #double check it gives you Sigma back!