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. > ## Clogg & Shihadeh (1994), Tables 3.5a and b (p. 55-61) > # See also ?rc > > library(logmult) Loading required package: gnm Attaching package: 'logmult' The following object is masked from 'package:gnm': se > data(gss88) > model <- rc(gss88, start=NA) Running base model to find starting values... Running real model... Initialising Running main iterations.............................. Done > > # Unweighted scores > summary(model, weighting="none") Call: rc(tab = gss88, start = NA) Deviance Residuals: Min 1Q Median 3Q Max -2.7608 -0.4975 0.0749 0.4650 1.9374 Association coefficients: Normalized Adjusted Dim1 8.075599 NA Dim1:OccupationProfessional-I 0.565514 1.6071 Dim1:OccupationProfessional-II 0.564018 1.6028 Dim1:OccupationManagers 0.146153 0.4153 Dim1:OccupationClerical -0.013199 -0.0375 Dim1:OccupationCraftsmen-I -0.232452 -0.6606 Dim1:OccupationCraftsmen-II 0.037196 0.1057 Dim1:OccupationOperatives (NT) -0.417400 -1.1861 Dim1:OccupationOperatives -0.196173 -0.5575 Dim1:OccupationFarmers -0.189421 -0.5383 Dim1:OccupationService -0.160650 -0.4565 Dim1:OccupationMissing -0.103587 -0.2944 Dim1:Years.of.Schooling0-7 -0.561801 -1.5965 Dim1:Years.of.Schooling8-11 -0.409544 -1.1638 Dim1:Years.of.Schooling12 -0.084106 -0.2390 Dim1:Years.of.Schooling13-15 0.065232 0.1854 Dim1:Years.of.Schooling16 0.408340 1.1604 Dim1:Years.of.Schooling17+ 0.581879 1.6536 No standard errors available (jackknife and bootstrap disabled, or weighting changed since fitting). Normalization weights: none Deviance: 53.47085 Pearson chi-squared: 52.12034 Dissimilarity index: 7.179518% Residual df: 36 BIC: -200.8605 AIC: -18.52915 > # Marginally weighted scores > summary(model, weighting="marginal") Call: rc(tab = gss88, start = NA) Deviance Residuals: Min 1Q Median 3Q Max -2.7608 -0.4975 0.0749 0.4650 1.9374 Association coefficients: Normalized Adjusted Dim1 0.7320591 NA Dim1:OccupationProfessional-I 1.7834155 1.5259 Dim1:OccupationProfessional-II 1.7783737 1.5216 Dim1:OccupationManagers 0.3700858 0.3166 Dim1:OccupationClerical -0.1669616 -0.1429 Dim1:OccupationCraftsmen-I -0.9058900 -0.7751 Dim1:OccupationCraftsmen-II 0.0028784 0.0025 Dim1:OccupationOperatives (NT) -1.5291990 -1.3084 Dim1:OccupationOperatives -0.7836197 -0.6705 Dim1:OccupationFarmers -0.7608640 -0.6510 Dim1:OccupationService -0.6639001 -0.5680 Dim1:OccupationMissing -0.4715891 -0.4035 Dim1:Years.of.Schooling0-7 -1.8890420 -1.6163 Dim1:Years.of.Schooling8-11 -1.3906757 -1.1899 Dim1:Years.of.Schooling12 -0.3254488 -0.2785 Dim1:Years.of.Schooling13-15 0.1633656 0.1398 Dim1:Years.of.Schooling16 1.2864265 1.1007 Dim1:Years.of.Schooling17+ 1.8544550 1.5867 No standard errors available (jackknife and bootstrap disabled, or weighting changed since fitting). Normalization weights: marginal Deviance: 53.47085 Pearson chi-squared: 52.12034 Dissimilarity index: 7.179518% Residual df: 36 BIC: -200.8605 AIC: -18.52915 > # Uniformly weighted scores > summary(model, weighting="uniform") Call: rc(tab = gss88, start = NA) Deviance Residuals: Min 1Q Median 3Q Max -2.7608 -0.4975 0.0749 0.4650 1.9374 Association coefficients: Normalized Adjusted Dim1 0.994038 NA Dim1:OccupationProfessional-I 1.875598 1.8700 Dim1:OccupationProfessional-II 1.870636 1.8651 Dim1:OccupationManagers 0.484735 0.4833 Dim1:OccupationClerical -0.043775 -0.0436 Dim1:OccupationCraftsmen-I -0.770957 -0.7687 Dim1:OccupationCraftsmen-II 0.123365 0.1230 Dim1:OccupationOperatives (NT) -1.384358 -1.3802 Dim1:OccupationOperatives -0.650631 -0.6487 Dim1:OccupationFarmers -0.628237 -0.6264 Dim1:OccupationService -0.532814 -0.5312 Dim1:OccupationMissing -0.343560 -0.3425 Dim1:Years.of.Schooling0-7 -1.376125 -1.3720 Dim1:Years.of.Schooling8-11 -1.003175 -1.0002 Dim1:Years.of.Schooling12 -0.206016 -0.2054 Dim1:Years.of.Schooling13-15 0.159786 0.1593 Dim1:Years.of.Schooling16 1.000224 0.9972 Dim1:Years.of.Schooling17+ 1.425306 1.4211 No standard errors available (jackknife and bootstrap disabled, or weighting changed since fitting). Normalization weights: uniform Deviance: 53.47085 Pearson chi-squared: 52.12034 Dissimilarity index: 7.179518% Residual df: 36 BIC: -200.8605 AIC: -18.52915 > > unweighted <- assoc(model, weighting="none") > marginal <- assoc(model, weighting="marginal") > uniform <- assoc(model, weighting="uniform") > > stopifnot(all.equal(round(c(unweighted$row, unweighted$row * sqrt(unweighted$phi[1]), + marginal$row, marginal$row * sqrt(marginal$phi[1]), + uniform$row, uniform$row * sqrt(uniform$phi[1])), 2), + c(0.57, 0.56, 0.15, -0.01, -0.23, 0.04, -0.42, -0.2, -0.19, -0.16, -0.1, + 1.61, 1.6, 0.42, -0.04, -0.66, 0.11, -1.19, -0.56, -0.54, -0.46, -0.29, + 1.78, 1.78, 0.37, -0.17, -0.91, 0, -1.53, -0.78, -0.76, -0.66, -0.47, + 1.53, 1.52, 0.32, -0.14, -0.78, 0, -1.31, -0.67, -0.65, -0.57, -0.4, + 1.88, 1.87, 0.48, -0.04, -0.77, 0.12, -1.38, -0.65, -0.63, -0.53, -0.34, + 1.87, 1.87, 0.48, -0.04, -0.77, 0.12, -1.38, -0.65, -0.63, -0.53, -0.34))) > stopifnot(all.equal(round(c(unweighted$col, unweighted$col * sqrt(unweighted$phi[1]), + marginal$col, marginal$col * sqrt(marginal$phi[1]), + uniform$col, uniform$col * sqrt(uniform$phi[1])), 2), + c(-0.56, -0.41, -0.08, 0.07, 0.41, 0.58, + -1.6, -1.16, -0.24, 0.19, 1.16, 1.65, + -1.89, -1.39, -0.33, 0.16, 1.29, 1.85, + -1.62, -1.19, -0.28, 0.14, 1.1, 1.59, + -1.38, -1, -0.21, 0.16, 1, 1.43, + -1.37, -1, -0.21, 0.16, 1, 1.42))) > > # Test anova > indep <- gnm(Freq ~ Occupation + Years.of.Schooling, data=gss88, family=poisson) > anova(indep, unweighted, test="LR") Analysis of Deviance Table Model: poisson, link: log Response: Freq Terms added sequentially (first to last) Df Deviance Resid. Df Resid. Dev Pr(>Chi) NULL 65 1359.84 Occupation 10 464.10 55 895.75 < 2.2e-16 *** Years.of.Schooling 5 440.69 50 455.06 < 2.2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 > > proc.time() user system elapsed 1.26 0.17 1.39