Infer: Infer

Description Usage Arguments Value Examples

Description

Infer is a generic function which carries out inference for a given model. For now only a pure Gaussian model is considered; however one has various options with which to carry out the Gaussian update in order to maximise use of resources, for example on linear combinations of the state-space rather than the whole space/

Usage

1
2
3
4
Infer(Graph, ...)

## S4 method for signature 'Graph_2nodes'
Infer(Graph, SW = 0, Comb = NULL)

Arguments

Graph

object of class Graph_2nodes.

SW

if 1, the Shermany Woodbury is used for inference over linear combinations, see vignette for details. This option cannot be set if linear combinations are not specified.

Comb

an m \times n matrix where each row is a binary vector indicating which of the n states constitute the linear combination.

Value

List with fields Graph (the original graph) and Post_GMRF. The latter is an object of class GMRF with mean and precision given by the update. If a set of linear combinations is desired, then the list also contains a field Comb_results, a list with entries mu and cov, the mean and covariance over the linear combinations respectively.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## Not run: 
require(Matrix)
data(icesat)
data(surf_fe)

## First create observation object
icesat_obs <- Obs(df=icesat,
                 abs_lim = 5,
                 avr_method = "median",
                 box_size=100,
                 name="icesat")

## Now create GMRF defined over some FE basis
Mesh <- initFEbasis(p=surf_fe$p,
                    t=surf_fe$t,
                    M=surf_fe$M,
                    K=surf_fe$K)

mu <- matrix(0,nrow(Mesh),1)
Q <- sparseMatrix(i=1:nrow(surf_fe$p), j = 1:nrow(surf_fe$p), x = 1)

my_GMRF <- GMRF(mu = mu, Q = Q,name="SURF",t_axis = 0:6)
SURF <-GMRF_basis(G = my_GMRF, Basis = Mesh)

L1 <- link(SURF,icesat_obs)
e <- link_list(list(L1))
v <- block_list(list(O = icesat_obs, G = SURF))
G <- new("Graph",e=e,v=v)
G_reduced <- compress(G)
Results <- Infer(G_reduced)

## End(Not run)

shazhe/mvst0 documentation built on May 29, 2019, 9:20 p.m.