Learn R Programming

AnalyzeFMRI (version 1.1-11)

N2G.Spatial.Mixture: fMRI Spatial Mixture Modelling

Description

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

Usage

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.mapPosterior Probability Map of activation
  • parFitted parameters of the underlying N2G model
  • limsNormal component interval for fitted model

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

Run this code
## 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

Run the code above in your browser using DataLab