N2G.Spatial.Mixture: fMRI Spatial Mixture Modelling

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/spatial.mixture.R

Description

Fits the spatial mixture model of Hartvig and Jensen (2000)

Usage

1
2
N2G.Spatial.Mixture(data, par.start = c(4, 2, 4, 2, 0.9, 0.05),
                    ksize, ktype = c("2D", "3D"), mask = NULL)

Arguments

data

The dataset (usually a vector)

par.start

Starting values for N2G model

ksize

Kernel size (see paper)

ktype

Format of kernel "2D" or "3D"

mask

Mask for dataset.

Value

p.map = a1, par = fit$par, lims = fit$lims Returns a list with following components

p.map

Posterior Probability Map of activation

par

Fitted parameters of the underlying N2G model

lims

Normal component interval for fitted model

Author(s)

J. L. Marchini

References

Hartvig and Jensen (2000) Spatial Mixture Modelling of fMRI Data

See Also

N2G.Class.Probability, N2G.Likelihood.Ratio, N2G.Density , N2G.Likelihood , N2G.Transform, N2G.Fit , N2G , N2G.Inverse , N2G.Region

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
## simulate image
d <- c(100, 100, 1)
y <- array(0, dim = d)
m <- y
m[, , ] <- 1

z.init <- 2 * m
z.init[20:40, 20:40, 1] <- 1
z.init[50:70, 50:70, 1] <- 3

y[z.init == 1] <- -rgamma(sum(z.init == 1), 4, 1)
y[z.init == 2] <- rnorm(sum(z.init == 2))
y[z.init == 3] <- rgamma(sum(z.init == 3), 4, 1)

mask <- 1 * (y < 1000)

## fit spatial mixture model
ans <- N2G.Spatial.Mixture(y, par.start = c(4, 2, 4, 2, 0.9, 0.05),
                           ksize = 3, ktype = "2D", mask = m) 

## plot original image, standard mixture model estimate and spatial mixture
## model estimate

par(mfrow = c(1, 3))
image(y[, , 1])
image(y[, , 1] > ans$lims[1]) ## this line plots the results of a Non-Spatial Mixture Model
image(ans$p.map[, , 1] > 0.5) ## this line plots the results of the Spatial Mixture Model

AnalyzeFMRI documentation built on Oct. 5, 2021, 5:06 p.m.