pattnpml.fit(formula,
random = ~1,
k = 1,
design,
tol = 0.5,
startp = NULL,
EMmaxit = 500,
EMdev.change = 0.001,
seed = NULL,
pr.it = FALSE
)y ~ x).random = ~o1+o2+o3 to model overdispersion. For more details, see below.patt.design (mandatory, even if it is attached to the workspace!).tol scalar (usually, $0 <$tol $\le 1$). This scalar sets the scaling factor for the locations of the initial mass points. A larger value means that the starting point locations are more widely spread.$k specifying the starting probabilities for the mass points to initiailise the EM algorithm. The default is to take gausssian quandrature probabilities.NULL, the seed is set using the system time.TRUE.pattNPML
The object contains the following 29 components:z corresponds to the standard deviation of the mixing distribution.-2logL) of the fitted mixture regression model.sdev$sdev and sdev$sdevk.
The former is the estimated standard deviation of the Gaussian mixture components (estimated over all mixture components), and the latter gives the unequal or smooth component-specific standard deviations.
All values are equal if lambda=0.shape$shape and shape$shapek, to be interpreted in analogy to sdev.glm object from the last EM iteration.alldist in package pattnpml.fit is a wrapper function for alldistPC which
in turn is a modified version of the function alldist from the
k of the finite mixture has to be specified beforehand.
The EM algorithm used by the function takes the Gauss-Hermite masses
and mass points as starting points. The position of the starting points can
be concentrated or extended by setting tol smaller or larger,
respectively; the initial mass point probabilities of the starting points can also be specified through startp.
Fitting models for overdispersion can be achieved by specifying the paired comparison items as additive terms
in the random part of the model formula. A separate estimate for each item and for each mass point is produced.
Fitting subject covariate models with the same effect for each mass
point component is achieved by
specifying as part of the formula a) a subject factor giving a
different estimate for each covariate combination
b) an interaction of the chosen subject covariates with the objects. For
models with subject factor covariates only, the first term
is simply the interaction of all of the factor covariates.
Fitting subject covariate models with a different effect for each mass
point component (sometimes called random coefficient models, see Aitkin,
Francis, Hinde and Darnell, 2009, pp. 497) is possible by specifying an
interaction of the subject covariates with the items in the
random term, and also in the formula part. Thus the setting random= ~
x:(o1+o2+o3 gives a model with a set of random slopes (one set for each
mass point) and a set of random intercepts, one set for each mass point.
The AIC and BIC functions from the glm# two latent classes for paired comparison data
dfr <- patt.design(dat4, 4)
modPC <- pattnpml.fit(y ~ 1, random = ~o1 + o2 + o3, k = 2, design = dfr)
modPC
# estimated proportion of cases in each mixture component
apply(modPC$post.prob, 2, function(x){ sum(x * dfr$y / sum(dfr$y)) })
# fitting a model for two latent classes and fixed categorical subject
# covariates to the Eurobarometer 55.2 data (see help("euro55.2.des"))
# on rankings of sources of information on scientific developments
model2cl <- pattnpml.fit(
y ~ SEX:AGE4 + (SEX + AGE4):(TV + RAD + NEWSP + SCIMAG + WWW + EDINST) - 1,
random = ~ TV + RAD + NEWSP + SCIMAG + WWW + EDINST,
k = 2, design = euro55.2.des, pr.it = TRUE)
summary(model2cl)
BIC(model2cl)Run the code above in your browser using DataLab