Fit Models to Two-Way Tables with Correlated Ordered Response Categories
Agresti's simple diganal quasi-symmetry model.
Computes staring values for marginal pi.
Computes the weighted statistics listed in section 2.3.
Computes weighted tau from Section 2.1. Agresti, A. (1983). Testing ma...
Bhapkar's (1979) test for marginal homogeneity
Bhapkar's 1979 test for quasi-symmetry.
Computes Bowker's test of symmetry.
Fits Goodman's (1979) uniform association model
Case where j == r, i == k == k2
Case where j == r, i != k, i == k2
Case where j == r, i != k && i != k2
Case where pi[i, r] with k and k2
Case where i == j, i < r, j < r
Case where pi[r, r] with k and k2
Case where i != j, i < r && j < r
Fits marginal homogeneity model
Computes the MDIS between the two matrices provided.
Renormalize counts to account for truncation of diagonal
Fitss the quasi-symmetry model.
Fit for quasi-symmetry model. Obtained by subtraction, so no model-bas...
Fits symmetry model.
Tests whether a square matrix is invertible (non singular)
Determines if its argument is not a valid number.
Computes Cohen's 1960 kappa coefficient
Computes the likelihood ratio G^2 measure of fit.
Function to load a data set written out using save().
Computes the multinomial log(likelihood).
Adds indicator variables for the diagonal cells in table n.
Appends a column to an existing design matrix.
Creates missing column names
Creates a vector containing the linear-by-linear vector.
Computes the logs of the cell frequencies.
Creates design matrix for model with main effects and a single agreeme...
Fits a log-linear model to the data provided, using the design matrix ...
Design matrix for baseline independence model with main effects for ro...
Converts a matrix of data into a vector suitable for use in analysis w...
Creates the design matrix for a quasi-symmetry design
Removes a column from an existing design matrix.
Creates design matrix for symmetry model.
Computes the log-odds (logit) for the value provided
Computes sums c+ used in maximizing the log(likelihod)
Compute the linear constraint on psi elements for identifiablity.
Computes cumulative sums for rows,
Computes the model-based cumulative probability matrices pij and qij
Computes the degrees of freedom for the model
Computes value of gamma from phi. Inverse of usual computation.
Computes value of gamma[j + 1] from phi.
Computes gamma from x and beta
Coompute the model-based cumulative probabilities pij and qij.
Cpompute matrix pi under generalized model.
Computes lambda, log of cumulative odds.
Computes the log(likelihood) for the general nonlinear model.
Compute the observed sums Nij
Compute the value of the Lagrange multiplier for the constraint on psi...
Compute matrix of model-based logits
Computes phi based on gamma
Computes matrix of p-values pi based on x and current value of beta.
Compute the cell probabilities pi from gamma.
Compute the regular (non-cumulative) model-based pi values
Computes regression weights w; R_dot_j * (N - R_dot_j[j]) * (n_do_j[j]...
Compute sums too use in maximizing log(likelihood)
Compute the Newton-Raphson update.
Computes Z, where z is w * lambda.
Computes sums used in maximizing theta.
Initializes symmetry matrix phi
Maximizes log(likelihood) wrt phi.
Maximizes the log(likelihood) wrt theta.
Computes model-based proportions.
Fits the McCullagh (1978) conditional-symmetry model.
Derivative of the condition wrt psi[i, j].
Derivative of gamma j + 1 wrt phi.
Derivative of gamma wrt phi.
Derivative of y wrt gamma.
Derivative of Lagrangian wrt delta_vec.
Derivative of Lagrange multiplier wrt scalar delta.
Derivative of Lagrangian wrt psi[i1, j1].
Derivative of log(likelihood) wrt alpha[index].
Derivative of log(likelihood) wrt beta, as given in appendix of McCull...
Derivative of log(likelihood) wrt c.
Derivative of log(likelihood) wrt delta_vec[k].
Derivative of log(likelihood) wrt delta (scalar or vector0.
Derivative of log(likelihood) wrt parameters.
Derivative of log(likelihood) wrt phi[i, j]
Derivative of log(likelihood) wrt psi.
Derivative of Lagrange multiplier omega wrt alpha[index].
Derivative of Lagrange multiplier omega wrt c.
Derivative of Lagrange multiplier omega wrt vector delta[k].
Derivative of Lagrange multiplier omega wrt scalar delta.
Derivative of Lagrange multiplier omega wrt psi[i, j].
Derivative of phi wrt gamma.
Derivative of pi[i, j] wrt alpha[index].
Derivative pi[i, j] wrt c.
Derivative pi[i, j] wrt delta[k].
Derivative of pi[i, j] wrt delta.
Derivative of pi[i, j] wrt psi[i1, j1].
Derivative of pij[i, j] wrt alpha[index]
Derivative pij[i, j] wrt c.
Derivative pij[i,j] wrt vector delta[k].
Derivative of pij[i, j] wrt scalar delta.
Derivative of pij[a, b] wrt psi[h, k]
Extracts the weights to convert cumulative model-based probabilities t...
Fit location model
Second derivative of log(likelihood) wrt psi[i1, j1] and delta_vec[k].
Second derivative of log(likelihood) wrt psi[i1, j1] and scalar delta....
Second derivative of Lagrange multiplier omega wrt alpha^2.
Second derivative of Lagrange multiplier omega wrt alpha[index] and c.
Second derivative of Lagrange multiplier omega wrt c^2.
Second derivative of Lagrange multiplier omega wrt scalae delta^2.
Second derivative of Lagrange multiplier omega wrt delta and alpha[ind...
Second derivative of Lagrange multiplier omega wrt scalar delta and c.
Second derivative of Lagrange multiplier omega wrt delta_vec^2.
Second derivative of Lagrange multiplier omega wrt delta_vec[k] and al...
Second derivative of Lagrange multiplier omega wrt delta_vec[k] and c.
Second derivative of Lagrange multiplier omega wrt psi^2.
Second derivative of Lagrange multiplier omega wrt psi[i1, j1] and alp...
Second derivative of Lagrange multiplier omega wrt psi[i1, j1] and c.
Second derivative of Lagrange multiplier omega wrt psi[i1, j1] and del...
Second derivative of Lagrange multiplier omega wrt psi and scalar delt...
Second derivative of pi[i, j] wrt alpha^2.
Second derivaitve of pi[i, j] wrt alpha[index] and c.
Second order derivative of pi[i, j] wrt c^2.
Second order derivative of pi[i, j] wrt scalar delta.
Second order deriviative of pi[i, j] wrt scalar delta and alpha[index]
Second order derivative of pi[i, j] wrt scalae delta and c.
Derivative of pi[i, j] wrt delta^2.
Second order dertivative of pi[i, j] wrtt delta[k] alpha[index].
Second derivative of pi[i, j] wrt delta[k] and c.
Second order derivative wrt psi^2.
Second order derivative of pi[i, j] wrt psi[i1, j1] and alpha[index].
Second order derivative of pi[i, j] wrt psi[i1, j1] and c.
Second order derivaitve of pi[i, j] wrt psi[i1, j1] and kelta[k].
Second order derivaitve of pi wrt pshi and scalar delta.
Update the parameters based on Newton-Raphson step.
Compute v_inverse (from appendix).
Computes the column association values theta-hat
Gets the overall effects for Model I.
Computes model-based expected cell counts for Model I
Normalizes pi(fHat) to sum to 1.0. If exclude_diagonal is TRUE, the su...
Computes the table of adjacent odds-ratios theta-hat.
Computes the row association values theta-hat
Gets the Model I* effects.
Computes expected frequencies for Model I*
Updates the row/column parameters for Model I*.
Computes crude starting values for Model I.
Updates the estimate of the alpha vector for Model I
Updates the estimate of the beta vector for Model I
Updates the estimate of the delta vector for Model I
Updates the estimate of the gamma vector for Model I
Computes the overall association theta and the row and column effects ...
Gets the effects phi, ksi_i_dot and ksi_dot_j for Model II results.
Computes expected counts for Model II
Gets the effects phi, ksi_i_dot and ksi_dot_j for Model II matrix of o...
Gets the effects for Model II*
Computes expected counts for Model II*
Updates estimate of phi vector
Computes crude starting values for Model II
Updates the estimate of the alpha vector for Model II
Updates the estimate of the beta vector for Model II
Updates the estimate of the rho vector for Model II
Updates the estimate of the sigma vector for Model II
Computes expected counts for null association model
Computes the Pearson X^2 statistic.
Computes the degrees of freedom for the model.
Compute matrix of model-based proportions pi.
Computes starting values for the model.
Derivative of log(likelihood) wrt kappa.
Derivative of log(likelihood) wrt marginal_pi[k]
Derivative of log(likelihood) wrt v[i1, j1]
Derivative of pi[i, j] wrt kappa coefficient.
Derivative of pi[i, j] wrt marginal_pi[k].
Computes derivative of pi[i, j] wrt v[i1, j1]
Computes derivative of v[i1, j1] wrt v[i2, j2]
Compute v matrix subject to constraints on rows 1..r-1.
Gradient vector log(L) wrt parameters.
Computes the hessian matrix of second-order partial derivatives of log...
Determines whether the candidate pi matrix is valid.
Performs Newton-Raphson step.
Second order partial log(L) wrt kappa^2.
Second order partial log(L) wrt kappa and v.
Second order partial log(L) wrt marginal_pi^2.
Second order partial log(L) wrt marginal_pi and kappa.
Second order partial log(L) wrt marginal_pi and v.
Second order partial log(L) wrt v^2.
Second order partial wrt kappa, kappa
Second order partial wrt kappa, v
Second derivative of pi[i, j] wrt marginal_pi[k]^2
Second order partial wrt kappa, marginal_pi
Second order partial pi wrt marginal_pi and v
Second order partial wrt v^2
Solves for the last row and diagonal of symmetry matrix v (v-tilde) us...
Solves for the last row and diagonal of symmetry matrix v (parameteer ...
Computes the model that has kappa as a coefficient and symmetry.
Computes the Newton-Raphson update
Computes the common diagonal term v-tilde.
Computes Stuart's Q test of marginal homogeneity.
Computes expected counts for uniform association model
Updates estimate of theta value of the uniform association model
Computes the sampling variance of kappa.
Computes the sampling variance of weighted kappa.
Fits the diagonal effects model, where each category has its own param...
Fits the diagonal effects model, where each category has its own param...
Fits the diagonal effects model, where there is a single delta paramet...
Fits the equal weighted diagonal model, where the diagonals all have a...
Fits the basic independent rows and columns model incorporating a line...
Fits the base model with only independent row and column effects.
Creates design matrix for weight be response category model.
Computes the weighted covariance
Computes Cohen's 1968 weighted kappa coefficient
Computes the weighted variance
Computes d-statistic based on scores and integer weights(frequencies) ...
Computes the independent groups d-statistic comparing the two vectors ...
Computes weighted version of dominance matrix "d"
Computes the constant of integration of a multinomial sample.
Converts weighted (x, w) pairs into unweighted data by replicating x[i...
Computes the "expit" function -- inverse of logit.
Fits the model where some of the delta parameters are constrained to b...
Fit's Goodman's diagonals parameter symmetry model.
Fits the model with given parameters fixed to specific values.
Fits the symmetric association model from Goodman (1979). Note the mod...
Computes the log(likelihood).
MCCullagh's logistic model.
Computed cumulative logits.
Maximize the log(likelihood) wrt parameters phi and alpha
Newton-Raphson update.
McCullagh's palindromic symmetry model
Computes the penalized value of a derivative by adding the derivative ...
Compute model-based cumulative probabilities
Computes the proportional hazards.
Initializes the asymmetry vector alpha
Initializes the phi matrix
Computes the model-based p-values
Fits McCullagh's (1978) quasi-symmetry model.
Second derivative of Lagrangian wrt psi^2.
Second derivative of Lagrangian wrt psi[i1, j1] and alpha[index].
Second derivative of Lagrangian wrt psi[i1, j1] and delta_vec[k[.
Second derivative of Lagrangian wrt psi[i1, j1] and delta.
Second derivative of log(likelihood) wrt alpha^2.
Second derivative of log(likelihood) wrt alpha[index] and c.
Expected values of second order derivatives of log(likelihood) wrt bet...
Second derivative of log(likelihood) wrt c^2.
Second derivative of log(likelihood) wrt delta^2.
Second derivative of log(likelihood) wrt delta and alpha[index].
Second derivative of log(likelihood) wrt scalar delta and c.
Second derivative of log(likelihood) wrt delta_vec^2.
Second derivative of log(likelihood) wrt delta[k] and alpha[index].
Second derivative of log(likeloihood) wrt delta_vec[k] and c.
Expected second order derivatives of log(likelihood)
Second derivative of log(likelihoood) wrt psi^2.
Second derivative of log(likelihoood) wrt ps[i1, j1] and alpha[index].
Second derivative of log(likelihood) wrt psi[i1, j1] and c.
Fits Agresti's agreement model that includes kappa as a parameter.
Generates counts from table frequencies for 5 category items
Generates counts from table frequencies for 6 category items
Solves equation Agresti_f() = 0 for delta by method of bisection..
Computes value of lambda parameter
Computes the matrix pi of model-based proportions
Creates the design matrix for Agresti's simple diagonal quasi-symmetry...
First equation in section 3. Solved for kappa.
Second equation in section 3. Solved for pi_margin.
Third equation in section 3. Solved for lambda
Extracts the quasi-symmetry information from the result provided.
Function value for first equation in section 3.
Compute the sum in the covariance of db+dw
Fits the tests comparing locations of the margins of a two-way table.
Clayton's stratified version of the marginal location comparison.
Analysis stratified by column variable j.
Computes summary, cumulative proportions up to index provided
Clayton's stratified measure of association
Converts two vectors containing scores and integer frequencies (cell c...
Computes between groups dominance matrix "d".
Generates counts from table frequencies for 2 category items
Generates counts from table frequencies for 3 category items
Generates counts from table frequencies for 4 category items
Computes sum term in covariance db-dw for weighted dominance matrix.
Computes Cliff's dependent d-statistics based on a dominance matrix.
Computes Cliff's dependent d-statistics based on a table of frequency ...
Computes Cliff's dependent d-statistics based on cell frequencies.
Computes Cliff's dependent d-statistics based on a dominance matrix.
Computes d-statistic from dominance matrix provided.
Computes independent group's d-statistic from the matrix of frequencie...
Performs ML estimation of the model.
Fits Goodman's (1979) Model I*
Fits Goodman's (1979) Model I
Fits Goodman's (1979) model II*, where row and column effects are equa...
Fits Goodman's (1979) Model II
Fits Goodman's L. A. (1979) Simple Models for the Analysis of Associat...
Computes the full matrix of model-based cell probabilities.
Computes the model-based probability for cell i, j
Generalized version of palindromic symmetry model
Computes culuative model probabilities for the generalized model using...
Generates names to label the parameters.
Computes summary statistics needed to compute estimate of delta.
Gradient vector of log(likelihood)
Hessian matrix of log(likelihood)
Initializes the beta vector.
Initialize vector delta
Compute initial values for scalar delta
Initialize the symmetry matrix psi
Initialize design matrix for location model.
Logical test of whether a specific psi will be in the constraint set.
Test whether pi matrix is valid, i.e., 0 < all values.
Fit a variety of models to two-way tables with ordered categories. Most of the models are appropriate to apply to tables of that have correlated ordered response categories. There is a particular interest in rater data and models for rescore tables. Some utility functions (e.g., Cohen's kappa and weighted kappa) support more general work on rater agreement. Because the names of the models are very similar, the functions that implement them are organized by last name of the primary author of the article or book that suggested the model, with the name of the function beginning with that author's name and an underscore. This may make some models more difficult to locate if one doesn't have the original sources. The vignettes and tests can help to locate models of interest. For more dertaiils see the following references: Agresti, A. (1983) <doi:10.1016/0167-7152(83)90051-2> "A Simple Diagonals-Parameter Symmetry And Quasi-Symmetry Model", Agrestim A. (1983) <doi:10.2307/2531022> "Testing Marginal Homogeneity for Ordinal Categorical Variables", Agresti, A. (1988) <doi:10.2307/2531866> "A Model For Agreement Between Ratings On An Ordinal Scale", Agresti, A. (1989) <doi:10.1016/0167-7152(89)90104-1> "An Agreement Model With Kappa As Parameter", Agresti, A. (2010 ISBN:978-0470082898) "Analysis Of Ordinal Categorical Data", Bhapkar, V. P. (1966) <doi:10.1080/01621459.1966.10502021> "A Note On The Equivalence Of Two Test Criteria For Hypotheses In Categorical Data", Bhapkar, V. P. (1979) <doi:10.2307/2530344> "On Tests Of Marginal Symmetry And Quasi-Symmetry In Two And Three-Dimensional Contingency Tables", Bowker, A. H. (1948) <doi:10.2307/2280710> "A Test For Symmetry In Contingency Tables", Clayton, D. G. (1974) <doi:10.2307/2335638> "Some Odds Ratio Statistics For The Analysis Of Ordered Categorical Data", Cliff, N. (1993) <doi:10.1037/0033-2909.114.3.494> "Dominance Statistics: Ordinal Analyses To Answer Ordinal Questions", Cliff, N. (1996 ISBN:978-0805813333) "Ordinal Methods For Behavioral Data Analysis", Goodman, L. A. (1979) <doi:10.1080/01621459.1979.10481650> "Simple Models For The Analysis Of Association In Cross-Classifications Having Ordered Categories", Goodman, L. A. (1979) <doi:10.2307/2335159> "Multiplicative Models For Square Contingency Tables With Ordered Categories", Ireland, C. T., Ku, H. H., & Kullback, S. (1969) <doi:10.2307/2286071> "Symmetry And Marginal Homogeneity Of An r × r Contingency Table", Ishi-kuntz, M. (1994 ISBN:978-0803943766) "Ordinal Log-linear Models", McCullah, P. (1977) <doi:10.2307/2345320> "A Logistic Model For Paired Comparisons With Ordered Categorical Data", McCullagh, P. (1978) <doi:10.2307/2335224> A Class Of Parametric Models For The Analysis Of Square Contingency Tables With Ordered Categories", McCullagh, P. (1980) <doi:10.1111/j.2517-6161.1980.tb01109.x> "Regression Models For Ordinal Data", Penn State: Eberly College of Science (undated) <https://online.stat.psu.edu/stat504/lesson/11> "Stat 504: Analysis of Discrete Data, 11. Advanced Topics I", Schuster, C. (2001) <doi:10.3102/10769986026003331> "Kappa As A Parameter Of A Symmetry Model For Rater Agreement", Shoukri, M. M. (2004 ISBN:978-1584883210). "Measures Of Interobserver Agreement", Stuart, A. (1953) <doi:10.2307/2333101> "The Estimation Of And Comparison Of Strengths Of Association In Contingency Tables", Stuart, A. (1955) <doi:10.2307/2333387> "A Test For Homogeneity Of The Marginal Distributions In A Two-Way Classification", von Eye, A., & Mun, E. Y. (2005 ISBN:978-0805849677) "Analyzing Rater Agreement: Manifest Variable Methods".