ModelStatistics {cmm}R Documentation

ModelStatistics

Description

If fitted frequencies under a model have been calculated, this procedure can be used to give sample values, fitted values, estimated standard errors, z-scores and adjusted residuals of one or more coefficients.

Usage

ModelStatistics(dat, fitfreq, model, coeff, CoefficientDimensions = "Automatic",
    Labels = "Automatic", Method = "ML", ShowCoefficients = TRUE, ShowParameters = FALSE, 
    ParameterCoding = "Effect", ShowCorrelations = FALSE, Title = "")

Arguments

dat

observed data as a list of frequencies or as a data frame

fitfreq

vector of fitted frequencies for each cell of full table (including latent variables, if any)

model

list specified eg as list(bt,coeff,at)

coeff

list of coefficients, can be obtained using SpecifyCoefficient

CoefficientDimensions

numeric vector of dimensions of the table in which the coefficient vector is to be arranged

Labels

list of characters or numbers indicating labels for dimensions of table in which the coefficient vector is to be arranged

ShowCoefficients

boolean, indicating whether or not the coefficients are to be displayed

ShowParameters

boolean, indicating whether or not the parameters (computed from the coefficients) are to be displayed

Method

character, choice of "ML" for maximum likelihood or "GSK" for the GSK method

ParameterCoding

Coding to be used for parameters, choice of "Effect", "Dummy" and "Polynomial"

ShowCorrelations

boolean, indicating whether or not to show the correlation matrix for the estimated coefficients

Title

title of computation to appear at top of screen output

Details

The data can be a data frame or vector of frequencies. MarginalModelFit converts a data frame dat using c(t(ftable(dat))).

For ParameterCoding, the default for "Dummy" is that the first cell in the table is the reference cell. Cell (i,j,k,...) can be made reference cell using list("Dummy",c(i,j,k,...)). For "Polynomial" the default is to use centralized scores based on equidistant (distance 1) linear scores, for example, if for i=1,2,3,4, \mu_i=\alpha+q_i\beta+r_i\gamma+s_i\delta where \beta is a quadratic, \gamma a cubic and \delta a quartic effect, then q_i takes the values (-1.5,-.5,.5,1.5), r_i takes the values (1,-1,-1,1) (centralized squares of the q_i), and s_i takes the values (-3.375,-.125,.125,3.375) (cubes of the q_i).

Value

A subset of the output of MarginalModelFit.

Author(s)

W. P. Bergsma w.p.bergsma@lse.ac.uk

References

Bergsma, W. P. (1997). Marginal models for categorical data. Tilburg, The Netherlands: Tilburg University Press. http://stats.lse.ac.uk/bergsma/pdf/bergsma_phdthesis.pdf

Bergsma, W. P., Croon, M. A., & Hagenaars, J. A. P. (2009). Marginal models for dependent, clustered, and longitudunal categorical data. Berlin: Springer.

See Also

ModelStatistics, MarginalModelFit

Examples


# Below an example where ModelStatistics can be used to get output for coefficients 
# not given by MarginalModelFit 

# Marginal homogeneity (MH) in a 3x3 table AB
# Note that MH is equivalent to independence in the 2x3 table of marginals IR, in which the 
# row with I=1 gives the A marginal, and the row with I=2 gives the B marginal 
n <- 1 : 9
at <- MarginalMatrix(c("A", "B"), list(c("A"), c("B")), c(3,3))
bt <- ConstraintMatrix(c("I", "R"), list(c("I"), c("R")), c(2,3))
model <- list( bt, "log", at)

#The "coefficients" for the model are the log marginal probabilities for table IR
fit <- MarginalModelFit(dat = n, model = model, 
 CoefficientDimensions = c(2, 3), Labels = c("I", "R"))

#to get output for the marginal probabilities, ModelStatistics can be used as follows
spec <-  SpecifyCoefficient("ConditionalProbabilities",list(c("I","R"),c("I"),c(2,3)))
coeff <- list(spec, at)
stats <- ModelStatistics(dat = n, fitfreq = fit$FittedFrequencies, 
 model = model, coeff = coeff, CoefficientDimensions = c(2, 3),
 Labels = c("I", "R"))

[Package cmm version 1.0 Index]