This function resamples the data, fits the semi-supervised mixture model, and returns the likelihood ratio test statistic. It is called by mixtura.

resam.lrts(y, z, dist, phi, pi, gamma, test, pass, ...)

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

test

resampling procedure: character "perm" (permutation) or "boot" (parametric bootstrap), or NULL

pass

parameters for parametric bootstrap algorithm

...

settings EM algorithm: starts, it.em and epsilon (see arguments)

Value

This function returns a numeric.

See also

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

Examples

# 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 # observed test statistic fit.wrap(y=y,z=z,dist="norm")$lrts
#> [1] 29.97413
# simulated test statistic resam.lrts(y=y,z=z,dist="norm", phi=NULL,pi=NULL,gamma=NULL, test="perm",pass=NULL)
#> [1] 1.577982