fit.wrap: Internal function

Description Usage Arguments Details Value See Also Examples

View source: R/functions.R

Description

This function fits the semi-supervised mixture model multiple times. It is called by mixtura and scrutor.

Usage

1
fit.wrap(y, z, dist, phi, pi, gamma, starts = 1, it.em = 100, epsilon = 1e-04)

Arguments

y

observations: numeric vector of length n

z

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

dist

distributional assumption: character "norm" (Gaussian), "nbinom" (negative bionomial), or "zinb" (zero-inflated negative binomial)

phi

dispersion parameters: numeric vector of length q, or NULL

pi

zero-inflation parameter(s): numeric vector of length q, or NULL

gamma

offset: numeric vector of length n, or NULL

starts

restarts of the EM algorithm: positive integer (defaults to 1)

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)

Details

The distributions are parametrised as follows:

Value

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

posterior

probability of belonging to class 1: numeric vector of length n

converge

path of the log-likelihood: numeric vector with maximum length it.em

estim0

parameter estimates under H0: data frame

estim1

parameter estimates under H1: data frame

loglik0

log-likelihood under H0: numeric

loglik1

log-likelihood under H1: numeric

lrts

likelihood-ratio test statistic: positive numeric

See Also

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

Examples

1
2
3
4
5
6
7
8
# data simulation
n <- 100
z <- rep(0:1,each=n/2)
y <- rnorm(n=n,mean=2*z,sd=1)
z[(n/4):n] <- NA

# model fitting
fit.wrap(y,z,dist="norm")

rauschenberger/semisup documentation built on May 11, 2020, 4 p.m.