Q.iid {ar.matrix}R Documentation

Precision matrix for a IID process

Description

Functions for creating precision matricies and observations of a independent identically distributed GMRF process.

Usage

Q.iid(M, sigma, sparse=FALSE,  vcov=FALSE)

r.iid(n, M, sigma)

Arguments

M

int > 0, number of elements in the process.

sigma

float > 0, standard deviat

sparse

bool Should the matrix be of class 'dsCMatrix'

vcov

bool If the vcov matrix should be returned instead of the precision matrix.

n

int > 0, number of observations to simulate from the GMRF.

Value

Q.iid returns either a precision or variance-covariance function with iid structure.

r.iid retrurns a matrix with n rows which are the n observations of a Gaussian Markov random field iid process.

Examples

require("leaflet")
require("sp")

# simulate iid data and attach to spatial polygons data frame
US.df@data$data <- c(r.iid(1, M=nrow(US.graph), sigma=1))

# color palette of data
pal <- colorNumeric(palette="YlGnBu", domain=US.df@data$data)

# see map
map1<-leaflet() %>%
    addProviderTiles("CartoDB.Positron") %>%
    addPolygons(data=US.df, fillColor=~pal(data), color="#b2aeae",
                fillOpacity=0.7, weight=0.3, smoothFactor=0.2) %>%
    addLegend("bottomright", pal=pal, values=US.df$data, title="", opacity=1)
map1


[Package ar.matrix version 0.1.0 Index]