SampleStatistics {cmm} | R Documentation |
SampleStatistics
Description
Gives sample values, standard errors and z-scores of one or more
coefficients. SampleStatistics(dat,coeff)
gives exactly the same output as ModelStatistics(dat,dat,"SaturatedModel",coeff)
.
Usage
SampleStatistics(dat, coeff, CoefficientDimensions = "Automatic",
Labels = "Automatic", ShowCoefficients = TRUE, ParameterCoding = "Effect",
ShowParameters = FALSE, ShowCorrelations = FALSE, Title = "", ShowSummary = TRUE)
Arguments
dat |
observed data as a list of frequencies or as a data frame |
coeff |
list of coefficients, can be obtained using |
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 |
ParameterCoding |
Coding to be used for parameters, choice of |
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 |
ShowSummary |
Show summary on the screen |
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
## Not run:
data(BodySatisfaction)
## Table 2.6 in Bergsma, Croon and Hagenaars (2009). Loglinear parameters for marginal table IS
## We provide two to obtain the parameters
dat <- BodySatisfaction[,2:8] # omit first column corresponding to gender
# matrix producing 1-way marginals, ie the 7x5 table IS
at75 <- MarginalMatrix(var = c(1, 2, 3, 4, 5, 6, 7),
marg = list(c(1),c(2),c(3), c(4),c(5),c(6),c(7)), dim = c(5, 5, 5, 5, 5, 5, 5))
# First method: the "coefficients" are the log-probabilities, from which all the
# (loglinear) parameters are calculated
stats <- SampleStatistics(dat = dat, coeff = list("log",at75), CoefficientDimensions = c(7, 5),
Labels = c("I", "S"), ShowCoefficients = FALSE, ShowParameters = TRUE)
# Second method: the "coefficients" are explicitly specified as being the
# (highest-order) loglinear parameters
loglinpar75 <- SpecifyCoefficient("LoglinearParameters", c(7, 5))
stats <- SampleStatistics(dat = dat, coeff = list(loglinpar75, at75),
CoefficientDimensions = c(7,5), Labels = c("I","S"))
## End(Not run)