multinomialFit: Multinomial fit test

View source: R/diagnose.R

multinomialFitR Documentation

Multinomial fit test

Description

For degrees of freedom, we use the number of observed statistics (incorrect) instead of the number of possible response patterns (correct) (see Bock, Giibons, & Muraki, 1998, p. 265). This is not a huge problem because this test is becomes poorly calibrated when the multinomial table is sparse. For more accurate p-values, you can conduct a Monte-Carlo simulation study (see examples).

Usage

multinomialFit(
  grp,
  independenceGrp,
  ...,
  method = "lr",
  log = TRUE,
  .twotier = TRUE
)

Arguments

grp

a list containing the model and data. See the details section.

independenceGrp

the independence group

...

Not used. Forces remaining arguments to be specified by name.

method

lr (default) or pearson

log

whether to report p-value in log units

.twotier

whether to use the two-tier optimization (default TRUE)

Details

Rows with missing data are ignored.

The full information test is described in Bartholomew & Tzamourani (1999, Section 3).

For CFI and TLI, you must provide an independenceGrp.

Format of a group

A model, or group within a model, is represented as a named list.

spec

list of response model objects

param

numeric matrix of item parameters

free

logical matrix of indicating which parameters are free (TRUE) or fixed (FALSE)

mean

numeric vector giving the mean of the latent distribution

cov

numeric matrix giving the covariance of the latent distribution

data

data.frame containing observed item responses, and optionally, weights and frequencies

score

factors scores with response patterns in rows

weightColumn

name of the data column containing the numeric row weights (optional)

freqColumn

name of the data column containing the integral row frequencies (optional)

qwidth

width of the quadrature expressed in Z units

qpoints

number of quadrature points

minItemsPerScore

minimum number of non-missing items when estimating factor scores

The param matrix stores items parameters by column. If a column has more rows than are required to fully specify a model then the extra rows are ignored. The order of the items in spec and order of columns in param are assumed to match. All items should have the same number of latent dimensions. Loadings on latent dimensions are given in the first few rows and can be named by setting rownames. Item names are assigned by param colnames.

Currently only a multivariate normal distribution is available, parameterized by the mean and cov. If mean and cov are not specified then a standard normal distribution is assumed. The quadrature consists of equally spaced points. For example, qwidth=2 and qpoints=5 would produce points -2, -1, 0, 1, and 2. The quadrature specification is part of the group and not passed as extra arguments for the sake of consistency. As currently implemented, OpenMx uses EAP scores to estimate latent distribution parameters. By default, the exact same EAP scores should be produced by EAPscores.

References

Bartholomew, D. J., & Tzamourani, P. (1999). The goodness-of-fit of latent trait models in attitude measurement. Sociological Methods and Research, 27(4), 525-546.

Bock, R. D., Gibbons, R., & Muraki, E. (1988). Full-information item factor analysis. Applied Psychological Measurement, 12(3), 261-280.

See Also

Other diagnostic: ChenThissen1997(), SitemFit1(), SitemFit(), rpf.1dim.fit(), sumScoreEAPTest()

Examples

# Create an example IFA group
grp <- list(spec=list())
grp$spec[1:10] <- rpf.grm()
grp$param <- sapply(grp$spec, rpf.rparam)
colnames(grp$param) <- paste("i", 1:10, sep="")
grp$mean <- 0
grp$cov <- diag(1)
grp$uniqueFree <- sum(grp$param != 0)
grp$data <- rpf.sample(1000, grp=grp)

# Monte-Carlo simulation study
mcReps <- 3    # increase this to 10,000 or so
stat <- rep(NA, mcReps)
for (rx in 1:mcReps) {
   t1 <- grp
   t1$data <- rpf.sample(grp=grp)
   stat[rx] <- multinomialFit(t1)$statistic
}
sum(multinomialFit(grp)$statistic > stat)/mcReps   # better p-value

rpf documentation built on Aug. 22, 2023, 1:06 a.m.