N2G: Fits the N2G model

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

View source: R/spatial.mixture.R

Description

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

Usage

1
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

See Also

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

Examples

1
2
3
4
5
6
7
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)

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

Related to N2G in AnalyzeFMRI...