fit.wrap {semisup} | R Documentation |
This function fits the semi-supervised mixture model multiple times.
It is called by mixtura
and scrutor
.
fit.wrap(y, z, dist, phi, pi, gamma, starts = 1, it.em = 100, epsilon = 1e-04)
y |
observations:
numeric vector of length |
z |
class labels:
integer vector of length |
dist |
distributional assumption:
character |
phi |
dispersion parameters:
numeric vector of length |
pi |
zero-inflation parameter(s):
numeric vector of length |
gamma |
offset:
numeric vector of length |
starts |
restarts of the |
it.em |
(maximum) number of iterations in the |
epsilon |
convergence criterion for the |
The distributions are parametrised as follows:
Gaussian
y ~ N(mean,sd^2)
E[y]=mean
Var[y]=sd^2
Negative binomial
y ~ NB(mu,phi)
E[y]=mu
Var[y]=mu+phi*mu^2
Zero-inflated negative binomial
y ~ ZINB(mu,phi,pi)
E[y]=(1-pi)*mu
This function returns the parameter estimates, the posterior probabilities, and the likelihood.
posterior |
probability of belonging to class 1:
numeric vector of length |
converge |
path of the log-likelihood:
numeric vector with maximum length |
estim0 |
parameter estimates under |
estim1 |
parameter estimates under |
loglik0 |
log-likelihood under |
loglik1 |
log-likelihood under |
lrts |
likelihood-ratio test statistic: positive numeric |
This is an internal
function.
The user functions are mixtura
and scrutor
.
# 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")