N2G {AnalyzeFMRI} R Documentation

## Fits the N2G model

### Description

Fits the N2G model (1 Normal and 2 Gamma's mixture model) to a dataset using Maximum Likelihhod.

### Usage

```N2G(data, par.start = c(4, 2, 4, 2, 0.9, 0.05))
```

### Arguments

 `data` The dataset. `par.start` The starting values for the optimization to maximize the likelihood. The parameters of the model are ordered in the vector par.start in the following way (refer to the model below) c(a, b, c, d, p1, p2)

### Details

The mixture model considered is a mixture of a standard normal distribution and two Gamma functions. This model is denoted N2G.

x ~ p1 * N(0, 1) + p2 * Gamma(a, b) + (1 - p1 - p2) * -Gamma(c, d)

### Value

A list with components

 `par` The fitted parameter values. `lims` The upper and lower thresholds for the Normal component of the fitted model

### Author(s)

J. L. Marchini

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

### Examples

```par <- c(3, 2, 3, 2, .3, .4)
data <- c(rnorm(10000), rgamma(2000, 10, 1), -rgamma(1400, 10, 1))
hist(data, n = 100, freq = FALSE)

q <- N2G.Fit(data, par, maxit = 10000, method = "BFGS")
p <- seq(-50, 50, .1)
lines(p, N2G.Density(p, q), col = 2)
```

[Package AnalyzeFMRI version 1.1-24 Index]