fit.nbinom: Internal function

Description Usage Arguments Value See Also Examples

View source: R/functions.R

Description

This function fits the semi-supervised negative binomial mixture model. It is called by fit.wrap.

Usage

1
fit.nbinom(y, z, phi, gamma, it.em, epsilon)

Arguments

y

observations: numeric vector of length n

z

class labels: integer vector of length n, with entries 0, 1 and NA

phi

dispersion parameters: numeric vector of length q, or NULL

gamma

offset: numeric vector of length n, or NULL

it.em

(maximum) number of iterations in the EM algorithm: positive integer (defaults to 100)

epsilon

convergence criterion for the EM algorithm: non-negative numeric (defaults to 1e-04)

Value

This function returns the parameter estimates, the posterior probabilities, and the likelihood.

See Also

This is an internal function. The user functions are mixtura and scrutor.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# data simulation
n <- 100
z <- rep(0:1,each=n/2)
gamma <- runif(n=n,min=0,max=2)
y <- rnbinom(n=n,mu=gamma*(5+2*z),size=1/0.05)
z[(n/4):n] <- NA

# model fitting
fit.nbinom(y,z,phi=0.05,gamma=gamma,
it.em=100,epsilon=1e-04)

semisup documentation built on Nov. 8, 2020, 6:32 p.m.