Description Usage Arguments Value Examples
Functions for creating precision matricies and observations of an RW2 process
1 2 3 |
M |
int > 0, number of elements in the RW2 process. |
sigma |
float > 0, pairwise observation standard deviation. |
sparse |
bool Should the matrix be of class 'dsCMatrix' |
n |
int > 0, number of observations to simulate from the GMRF. |
Q.RW2 returns a precision matrix with a RW2 structure.
r.RW2 retrurns a matrix with n rows which are the n observations of an Intrinsic Gaussian Markov random field RW2 process.
1 2 3 4 5 6 7 8 9 10 11 | require("ggplot2")
# simulate RW2 GMRF
obs <- r.RW2(100, M=30, sigma=1)
# resulting matrix is n x M
dim(obs)
# move objects to a data frame
RW2_df <- data.frame(obs=c(t(obs)), realization=rep(1:100, each=30),
time=rep(1:30, 100))
# plot each realization
ggplot(data=RW2_df, aes(time, obs, group=realization, color=realization)) +
geom_line()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.