R Under development (unstable) (2025-08-24 r88696 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## Yamaguchi (1990), Table 5, p. 202, and Table 6B, p. 205 > > library(logmult) Loading required package: gnm Attaching package: 'logmult' The following object is masked from 'package:gnm': se > data(ocg1973) > > # Simple symmetric RC(1) model ("Null skew-symmetry") > rc.model <- rc(ocg1973, diagonal=TRUE, symmetric=TRUE, weighting="none") Initialising Running start-up iterations.. Running main iterations....... Done > > # Reported phi is slightly different, coefficients agree > rc.model Call: rc(tab = ocg1973, symmetric = TRUE, diagonal = TRUE, weighting = "none") Intrinsic association coefficients: Dim1 1.94 Normalized row and column scores: UNM LNM UM LM F 0.690 0.303 -0.103 -0.332 -0.558 Diagonal coefficients: UNM LNM UM LM F 2.07446 0.28852 0.12524 0.35374 0.00674 Normalization weights: none Deviance: 46.64896 Pearson chi-squared: 51.69522 Dissimilarity index: 1.049807% Residual df: 7 BIC: -22.0295 AIC: 32.64896 > stopifnot(isTRUE(all.equal(round(rc.model$assoc$row[,1,1], d=2), + c(0.69, 0.3, -0.1, -0.33, -0.56), + check.attributes=FALSE))) > > > # Note model does not always converge, several attempts may be needed > # Here we set known starting values to be sure it works > set.seed(5) > model <- yrcskew(ocg1973, nd.symm=1, nd.skew=1, diagonal=TRUE, weighting="none") Running base model to find starting values... Initialising Running start-up iterations.. Running main iterations.... Done Running real model... Initialising Running main iterations................. Done > > # We do not get the same results as the author, but the smaller deviance > # indicates a better fit in our version (!) > model Call: yrcskew(tab = ocg1973, nd.symm = 1, nd.skew = 1, diagonal = TRUE, weighting = "none") Intrinsic symmetric association coefficients: Dim1 2.29 Normalized symmetric association scores: UNM LNM UM LM F 0.8506 0.0489 -0.2461 -0.3313 -0.3222 Intrinsic skew association coefficients: Dim1 -1.8 Normalized skew association scores: UNM LNM UM LM F -0.4207 -0.3320 -0.1662 0.0968 0.8221 Diagonal coefficients: UNM LNM UM LM F 2.416 0.198 0.318 0.592 -1.390 Normalization weights: none Deviance: 1.187443 Pearson chi-squared: 1.189223 Dissimilarity index: 0.1792143% Residual df: 3 BIC: -28.24618 AIC: -4.812557 > > > summary(model) Call: yrcskew(tab = ocg1973, nd.symm = 1, nd.skew = 1, diagonal = TRUE, weighting = "none") Deviance Residuals: D O UNM LNM UM LM F UNM 0.00e+00 -3.73e-01 4.02e-01 1.64e-01 -4.99e-01 LNM 2.21e-01 0.00e+00 -1.97e-01 -2.96e-01 5.62e-01 UM -2.02e-01 1.55e-01 0.00e+00 9.94e-02 -3.91e-02 LM -6.44e-02 1.55e-01 -4.21e-02 -4.71e-08 -8.47e-02 F 6.07e-02 -4.10e-02 -3.56e-02 1.22e-02 0.00e+00 Association coefficients: Normalized Adjusted Dim1 2.286413 NA Dim1:O|DUNM 0.850616 1.2862 Dim1:O|DLNM 0.048866 0.0739 Dim1:O|DUM -0.246076 -0.3721 Dim1:O|DLM -0.331254 -0.5009 Dim1:O|DF -0.322152 -0.4871 Dim1 -1.796569 NA Dim1:O|DUNM -0.420702 -0.5639 Dim1:O|DLNM -0.332003 -0.4450 Dim1:O|DUM -0.166162 -0.2227 Dim1:O|DLM 0.096794 0.1297 Dim1:O|DF 0.822073 1.1019 No standard errors available (jackknife and bootstrap disabled, or weighting changed since fitting). Diagonal coefficients: UNM LNM UM LM F 2.416 0.198 0.318 0.592 -1.390 Normalization weights: none Deviance: 1.187443 Pearson chi-squared: 1.189223 Dissimilarity index: 0.1792143% Residual df: 3 BIC: -28.24618 AIC: -4.812557 > > # These scores cannot be checked since the author reports a higher deviance: > # they are simply here to ensure no regressions appear > stopifnot(isTRUE(all.equal(c(round(model$assoc.yrcskew$row, d=3)), + c(-0.421, -0.332, -0.166, 0.097, 0.822)))) > stopifnot(isTRUE(all.equal(c(round(model$assoc$row, d=3)), + c(0.851, 0.049, -0.246, -0.331, -0.322)))) > > proc.time() user system elapsed 0.85 0.12 0.98