> library (gnm) > > ## Xie 1992 paper, Table 3 > table3<-structure(c(311, 161, 128, 88, 36, 43, 356, 150, 12, 130, 128, + 109, 83, 45, 23, 375, 180, 14, 79, 66, 89, 43, 38, 25, 325, 187, + 18, 24, 22, 26, 72, 27, 16, 108, 48, 5, 22, 11, 25, 41, 47, 14, + 140, 74, 18, 7, 6, 3, 5, 3, 99, 5, 9, 10, 70, 112, 197, 112, + 110, 86, 1506, 802, 96, 44, 47, 113, 64, 80, 81, 839, 685, 114, + 1, 1, 4, 4, 4, 40, 22, 15, 56, 105, 59, 40, 38, 40, 27, 36, 22, + 4, 72, 113, 86, 37, 68, 74, 138, 88, 18, 19, 37, 64, 17, 55, + 77, 93, 79, 26, 9, 9, 10, 38, 38, 27, 22, 18, 9, 8, 14, 20, 23, + 95, 52, 38, 24, 14, 3, 0, 4, 2, 10, 461, 5, 8, 19, 26, 54, 103, + 36, 92, 156, 339, 235, 68, 11, 34, 61, 22, 74, 286, 189, 209, + 107, 1, 2, 4, 1, 7, 73, 9, 11, 47, 52, 30, 10, 26, 8, 24, 33, + 32, 5, 15, 27, 19, 24, 13, 47, 89, 49, 10, 13, 14, 10, 5, 6, + 44, 40, 28, 3, 3, 3, 2, 20, 3, 17, 13, 14, 0, 2, 4, 4, 8, 9, + 22, 18, 17, 6, 0, 0, 0, 1, 4, 92, 5, 5, 3, 11, 27, 16, 33, 31, + 132, 188, 159, 33, 7, 12, 11, 22, 20, 144, 104, 109, 42, 0, 2, + 1, 0, 1, 21, 5, 4, 8), dim = c(9, 9, 3), dimnames = structure(list( + origin = c("I", "II", "III", "IVa", "IVb", "IVc", "V/VI", + "VIIa", "VIIb"), destination = c("I", "II", "III", "IVa", + "IVb", "IVc", "V/VI", "VIIa", "VIIb"), country = c("England", + "France", "Sweden")), .Names = c("origin", "destination", "country" + )), class = "table") > > table3 <- as.data.frame(table3) > lvl <- levels(table3$origin) > levels(table3$origin) <- levels(table3$destination) <- c(rep(paste(lvl[1:2], collapse = " + "), 2), lvl[3], rep(paste(lvl[4:5], collapse = " + "), 2), lvl[6:9]) > table3 <- xtabs(Freq ~ origin + destination + country, data = table3) > levelMatrix <- matrix(c(2, 3, 4, 6, 5, 6, 6, + 3, 3, 4, 6, 4, 5, 6, + 4, 4, 2, 5, 5, 5, 5, + 6, 6, 5, 1, 6, 5, 2, + 4, 4, 5, 6, 3, 4, 5, + 5, 4, 5, 5, 3, 3, 5, + 6, 6, 5, 3, 5, 4, 1), 7, 7, byrow = TRUE) > > ### Fit the levels models given in Table 3 of Xie (1992) > ## Null association between origin and destination > nullModel <- gnm(Freq ~ country:origin + country:destination, family = poisson, data = table3, verbose = FALSE) > nullModel Call: gnm(formula = Freq ~ country:origin + country:destination, family = poisson, data = table3, verbose = FALSE) Coefficients: (Intercept) countryEngland:originI + II countryFrance:originI + II countrySweden:originI + II 3.29392 2.44997 1.56302 0.70220 countryEngland:originIII countryFrance:originIII countrySweden:originIII countryEngland:originIVa + IVb 1.86796 1.17818 -0.41002 2.13010 countryFrance:originIVa + IVb countrySweden:originIVa + IVb countryEngland:originIVc countryFrance:originIVc 1.74794 0.75484 1.38227 2.32412 countrySweden:originIVc countryEngland:originV/VI countryFrance:originV/VI countrySweden:originV/VI 1.59663 3.53507 1.97426 1.50408 countryEngland:originVIIa countryFrance:originVIIa countrySweden:originVIIa countryEngland:originVIIb 2.99871 1.74939 1.33261 1.16322 countryFrance:originVIIb countrySweden:originVIIb countryEngland:destinationIII countryFrance:destinationIII 0.94992 NA -1.00300 -0.82440 countrySweden:destinationIII countryEngland:destinationIVa + IVb countryFrance:destinationIVa + IVb countrySweden:destinationIVa + IVb -1.14653 -1.16484 -0.82226 -1.13433 countryEngland:destinationIVc countryFrance:destinationIVc countrySweden:destinationIVc countryEngland:destinationV/VI -2.78106 -0.73241 -1.53980 0.26476 countryFrance:destinationV/VI countrySweden:destinationV/VI countryEngland:destinationVIIa countryFrance:destinationVIIa 0.04048 0.20544 -0.13764 -0.07000 countrySweden:destinationVIIa countryEngland:destinationVIIb countryFrance:destinationVIIb countrySweden:destinationVIIb -0.08542 -2.78106 -1.92730 -2.50261 Deviance: 4860.026 Pearson chi-squared: 6617.134 Residual df: 108 > > ## H_0 Interaction specified by levelMatrix, common to all countries > commonTopo <- update(nullModel, ~ . + Topo(origin, destination, spec = levelMatrix), verbose = FALSE) > commonTopo Call: gnm(formula = Freq ~ Topo(origin, destination, spec = levelMatrix) + country:origin + country:destination, family = poisson, data = table3, verbose = FALSE) Coefficients: (Intercept) Topo(origin, destination, spec = levelMatrix)2 Topo(origin, destination, spec = levelMatrix)3 5.97298 -1.18741 -1.95334 Topo(origin, destination, spec = levelMatrix)4 Topo(origin, destination, spec = levelMatrix)5 Topo(origin, destination, spec = levelMatrix)6 -2.31923 -2.64848 -3.27724 countryEngland:originI + II countryFrance:originI + II countrySweden:originI + II 1.78410 0.99436 0.11641 countryEngland:originIII countryFrance:originIII countrySweden:originIII 1.39654 0.80528 -0.77261 countryEngland:originIVa + IVb countryFrance:originIVa + IVb countrySweden:originIVa + IVb 1.70868 1.40342 0.47802 countryEngland:originIVc countryFrance:originIVc countrySweden:originIVc 1.39010 2.19838 1.79278 countryEngland:originV/VI countryFrance:originV/VI countrySweden:originV/VI 3.02990 1.58809 1.11227 countryEngland:originVIIa countryFrance:originVIIa countrySweden:originVIIa 2.45272 1.31559 0.91227 countryEngland:originVIIb countryFrance:originVIIb countrySweden:originVIIb 0.96837 0.81481 NA countryEngland:destinationIII countryFrance:destinationIII countrySweden:destinationIII -0.88893 -0.69116 -1.05467 countryEngland:destinationIVa + IVb countryFrance:destinationIVa + IVb countrySweden:destinationIVa + IVb -1.05721 -0.96696 -1.29556 countryEngland:destinationIVc countryFrance:destinationIVc countrySweden:destinationIVc -2.89351 -2.06227 -3.16151 countryEngland:destinationV/VI countryFrance:destinationV/VI countrySweden:destinationV/VI 0.25014 0.15383 0.19454 countryEngland:destinationVIIa countryFrance:destinationVIIa countrySweden:destinationVIIa 0.02625 0.04490 -0.12907 countryEngland:destinationVIIb countryFrance:destinationVIIb countrySweden:destinationVIIb -2.91592 -2.73643 -3.45828 Deviance: 244.3416 Pearson chi-squared: 249.0362 Residual df: 103 > > ## H_x Interaction specified by levelMatrix, different multiplier for each country > multTopo <- update(nullModel, ~ . + Mult(Exp(country), Topo(origin, destination, spec = levelMatrix)), verbose = FALSE) Warning message: In strsplit(specialTerms, ", inst = |,? ?\\)$", perl = TRUE) : perl = TRUE is only fully implemented in UTF-8 locales > multTopo Call: gnm(formula = Freq ~ Mult(Exp(country), Topo(origin, destination, spec = levelMatrix)) + country:origin + country:destination, family = poisson, data = table3, verbose = FALSE) Coefficients: (Intercept) Mult(Exp(.), Topo(origin, destination, spec = levelMatrix)).countryEngland 3.65966 -3.65427 Mult(Exp(.), Topo(origin, destination, spec = levelMatrix)).countryFrance Mult(Exp(.), Topo(origin, destination, spec = levelMatrix)).countrySweden -3.62066 -3.91443 Mult(Exp(country), .).Topo(origin, destination, spec = levelMatrix)1 Mult(Exp(country), .).Topo(origin, destination, spec = levelMatrix)2 86.65051 40.86615 Mult(Exp(country), .).Topo(origin, destination, spec = levelMatrix)3 Mult(Exp(country), .).Topo(origin, destination, spec = levelMatrix)4 10.92004 -3.43257 Mult(Exp(country), .).Topo(origin, destination, spec = levelMatrix)5 Mult(Exp(country), .).Topo(origin, destination, spec = levelMatrix)6 -16.47909 -41.58361 countryEngland:originI + II countryFrance:originI + II 1.86139 1.05497 countrySweden:originI + II countryEngland:originIII 0.29332 1.47803 countryFrance:originIII countrySweden:originIII 0.88540 -0.69284 countryEngland:originIVa + IVb countryFrance:originIVa + IVb 1.79069 1.48601 countrySweden:originIVa + IVb countryEngland:originIVc 0.54338 1.48478 countryFrance:originIVc countrySweden:originIVc 2.31224 1.73224 countryEngland:originV/VI countryFrance:originV/VI 3.11072 1.66748 countrySweden:originV/VI countryEngland:originVIIa 1.19430 2.53293 countryFrance:originVIIa countrySweden:originVIIa 1.39276 1.00188 countryEngland:originVIIb countryFrance:originVIIb 1.05713 0.91515 countrySweden:originVIIb countryEngland:destinationIII NA -0.88698 countryFrance:destinationIII countrySweden:destinationIII -0.68174 -1.08562 countryEngland:destinationIVa + IVb countryFrance:destinationIVa + IVb -1.05638 -0.98089 countrySweden:destinationIVa + IVb countryEngland:destinationIVc -1.24401 -2.90121 countryFrance:destinationIVc countrySweden:destinationIVc -2.16558 -2.61081 countryEngland:destinationV/VI countryFrance:destinationV/VI 0.24987 0.16040 countrySweden:destinationV/VI countryEngland:destinationVIIa 0.19465 0.02845 countryFrance:destinationVIIa countrySweden:destinationVIIa 0.04868 -0.11901 countryEngland:destinationVIIb countryFrance:destinationVIIb -2.92172 -2.80766 countrySweden:destinationVIIb -3.13241 Deviance: 216.3733 Pearson chi-squared: 214.7483 Residual df: 101 > > ## H_l Interaction specified by levelMatrix, different effects for each country > separateTopo <- update(nullModel, ~ . + country:Topo(origin, destination, spec = levelMatrix), verbose = FALSE) > separateTopo Call: gnm(formula = Freq ~ country:origin + country:destination + country:Topo(origin, destination, spec = levelMatrix), family = poisson, data = table3, verbose = FALSE) Coefficients: (Intercept) countryEngland:originI + II 5.38745 2.56494 countryFrance:originI + II countrySweden:originI + II 1.49989 0.27201 countryEngland:originIII countryFrance:originIII 2.15438 1.37311 countrySweden:originIII countryEngland:originIVa + IVb -0.68351 2.48775 countryFrance:originIVa + IVb countrySweden:originIVa + IVb 1.93997 0.53418 countryEngland:originIVc countryFrance:originIVc 2.14407 2.80133 countrySweden:originIVc countryEngland:originV/VI 1.72610 3.79283 countryFrance:originV/VI countrySweden:originV/VI 2.14216 1.20910 countryEngland:originVIIa countryFrance:originVIIa 3.20701 1.88846 countrySweden:originVIIa countryEngland:originVIIb 1.00659 1.71994 countryFrance:originVIIb countrySweden:originVIIb 1.40594 NA countryEngland:destinationIII countryFrance:destinationIII -0.90057 -0.66237 countrySweden:destinationIII countryEngland:destinationIVa + IVb -1.06911 -1.05192 countryFrance:destinationIVa + IVb countrySweden:destinationIVa + IVb -0.99366 -1.26460 countryEngland:destinationIVc countryFrance:destinationIVc -3.00107 -2.07104 countrySweden:destinationIVc countryEngland:destinationV/VI -2.60637 0.22582 countryFrance:destinationV/VI countrySweden:destinationV/VI 0.19340 0.19728 countryEngland:destinationVIIa countryFrance:destinationVIIa 0.01689 0.06046 countrySweden:destinationVIIa countryEngland:destinationVIIb -0.12089 -2.97703 countryFrance:destinationVIIb countrySweden:destinationVIIb -2.80136 -3.15380 countryEngland:Topo(origin, destination, spec = levelMatrix)2 countryFrance:Topo(origin, destination, spec = levelMatrix)2 -1.39369 -1.05079 countrySweden:Topo(origin, destination, spec = levelMatrix)2 countryEngland:Topo(origin, destination, spec = levelMatrix)3 -0.87718 -2.09731 countryFrance:Topo(origin, destination, spec = levelMatrix)3 countrySweden:Topo(origin, destination, spec = levelMatrix)3 -1.96456 -1.52570 countryEngland:Topo(origin, destination, spec = levelMatrix)4 countryFrance:Topo(origin, destination, spec = levelMatrix)4 -2.49637 -2.28650 countrySweden:Topo(origin, destination, spec = levelMatrix)4 countryEngland:Topo(origin, destination, spec = levelMatrix)5 -1.81656 -2.82748 countryFrance:Topo(origin, destination, spec = levelMatrix)5 countrySweden:Topo(origin, destination, spec = levelMatrix)5 -2.66133 -2.03066 countryEngland:Topo(origin, destination, spec = levelMatrix)6 countryFrance:Topo(origin, destination, spec = levelMatrix)6 -3.43591 -3.35664 countrySweden:Topo(origin, destination, spec = levelMatrix)6 -2.56470 Deviance: 208.4953 Pearson chi-squared: 210.2239 Residual df: 93 > > # FI_0 > FI0 <- gnm(Freq ~ country:origin + country:destination + origin:destination, family = poisson, data = table3) Linear predictor - using glm.fit > FI0 Call: gnm(formula = Freq ~ country:origin + country:destination + origin:destination, family = poisson, data = table3) Coefficients: (Intercept) countryEngland:originI + II countryFrance:originI + II countrySweden:originI + II 2.3949 4.2014 3.4077 2.5430 countryEngland:originIII countryFrance:originIII countrySweden:originIII countryEngland:originIVa + IVb 3.0632 2.4734 0.9108 3.1277 countryFrance:originIVa + IVb countrySweden:originIVa + IVb countryEngland:originIVc countryFrance:originIVc 2.8147 1.8915 1.4978 2.3236 countrySweden:originIVc countryEngland:originV/VI countryFrance:originV/VI countrySweden:originV/VI 1.9484 4.2115 2.7745 2.3184 countryEngland:originVIIa countryFrance:originVIIa countrySweden:originVIIa countryEngland:originVIIb 3.4280 2.2950 1.9120 0.9349 countryFrance:originVIIb countrySweden:originVIIb countryEngland:destinationIII countryFrance:destinationIII 0.7874 NA -1.6923 -1.5174 countrySweden:destinationIII countryEngland:destinationIVa + IVb countryFrance:destinationIVa + IVb countrySweden:destinationIVa + IVb -1.9146 -2.2535 -2.0710 -2.4253 countryEngland:destinationIVc countryFrance:destinationIVc countrySweden:destinationIVc countryEngland:destinationV/VI -4.5545 -3.8148 -4.9415 -1.3480 countryFrance:destinationV/VI countrySweden:destinationV/VI countryEngland:destinationVIIa countryFrance:destinationVIIa -1.4609 -1.4436 -2.0363 -2.0150 countrySweden:destinationVIIa countryEngland:destinationVIIb countryFrance:destinationVIIb countrySweden:destinationVIIb -2.2121 -5.1250 -5.0086 -5.7749 originIII:destinationIII originIVa + IVb:destinationIII originIVc:destinationIII originV/VI:destinationIII 0.7664 0.5259 1.1785 0.8737 originVIIa:destinationIII originVIIb:destinationIII originIII:destinationIVa + IVb originIVa + IVb:destinationIVa + IVb 1.1087 1.3616 0.6942 2.0211 originIVc:destinationIVa + IVb originV/VI:destinationIVa + IVb originVIIa:destinationIVa + IVb originVIIb:destinationIVa + IVb 1.7362 1.1281 1.2516 2.0137 originIII:destinationIVc originIVa + IVb:destinationIVc originIVc:destinationIVc originV/VI:destinationIVc 0.2356 1.2467 5.2175 0.1861 originVIIa:destinationIVc originVIIb:destinationIVc originIII:destinationV/VI originIVa + IVb:destinationV/VI 1.2217 3.5673 1.1752 1.2004 originIVc:destinationV/VI originV/VI:destinationV/VI originVIIa:destinationV/VI originVIIb:destinationV/VI 1.8831 2.0594 2.2149 2.5465 originIII:destinationVIIa originIVa + IVb:destinationVIIa originIVc:destinationVIIa originV/VI:destinationVIIa 1.2895 1.4672 2.8433 2.1475 originVIIa:destinationVIIa originVIIb:destinationVIIa originIII:destinationVIIb originIVa + IVb:destinationVIIb 2.7099 3.4853 1.3433 1.7560 originIVc:destinationVIIb originV/VI:destinationVIIb originVIIa:destinationVIIb originVIIb:destinationVIIb 4.6520 1.8053 2.3136 5.7280 Deviance: 121.3044 Pearson chi-squared: 135.5231 Residual df: 72 > > # FI_x Cross-nationally log-multiplicative full two-way R and C interaction > FIx <- gnm(Freq ~ country:origin + country:destination + Mult(Exp(country), origin:destination), ofInterest="[.]country", family = poisson, data = table3) Initialising Running start-up iterations.. Running main iterations....... Done Warning message: In strsplit(specialTerms, ", inst = |,? ?\\)$", perl = TRUE) : perl = TRUE is only fully implemented in UTF-8 locales > FIx Call: gnm(formula = Freq ~ country:origin + country:destination + Mult(Exp(country), origin:destination), ofInterest = "[.]country", family = poisson, data = table3) Coefficients of interest: Mult(Exp(.), origin:destination).countryEngland Mult(Exp(.), origin:destination).countryFrance Mult(Exp(.), origin:destination).countrySweden -0.8797 -0.8531 -1.1563 Deviance: 92.14113 Pearson chi-squared: 89.47847 Residual df: 70 > # contrast with sum of squared = 1 > # set ref="mean" is the same as recaling the results by normal score > getContrasts(FIx, ofInterest(FIx), ref="first", scaleRef="first", scaleWeights="unit") $covmat Mult(Exp(.), origin:destination).countryEngland Mult(Exp(.), origin:destination).countryFrance Mult(Exp(.), origin:destination).countryEngland 0.0010636748 0.0005180458 Mult(Exp(.), origin:destination).countryFrance 0.0005180458 0.0012257026 Mult(Exp(.), origin:destination).countrySweden 0.0005078843 0.0005079129 Mult(Exp(.), origin:destination).countrySweden Mult(Exp(.), origin:destination).countryEngland 0.0005078843 Mult(Exp(.), origin:destination).countryFrance 0.0005079129 Mult(Exp(.), origin:destination).countrySweden 0.0035555908 $qvframe Estimate Std. Error Mult(Exp(.), origin:destination).countryEngland 0.0000000 0.00000000 Mult(Exp(.), origin:destination).countryFrance 0.0956740 0.13299347 Mult(Exp(.), origin:destination).countrySweden -0.9954127 0.01278266 $relerrs NULL $modelcall gnm(formula = Freq ~ country:origin + country:destination + Mult(Exp(country), origin:destination), ofInterest = "[.]country", family = poisson, data = table3) attr(,"class") [1] "qv" > > anova(nullModel, commonTopo, multTopo, separateTopo) Analysis of Deviance Table Model 1: Freq ~ country:origin + country:destination Model 2: Freq ~ Topo(origin, destination, spec = levelMatrix) + country:origin + country:destination Model 3: Freq ~ Mult(Exp(country), Topo(origin, destination, spec = levelMatrix)) + country:origin + country:destination Model 4: Freq ~ country:origin + country:destination + country:Topo(origin, destination, spec = levelMatrix) Resid. Df Resid. Dev Df Deviance 1 108 4860.0 2 103 244.3 5 4615.7 3 101 216.4 2 28.0 4 93 208.5 8 7.9 > > > > # Xie's unidiff.do in r > library(foreign) > mob<-as.data.frame(read.dta('e:\\Huashan\\UM\\542\\Data\\xie\\mobility.dta')) > > # R(u) Conditional independence model, df=48 > Ru <- gnm(obs~ country:father + country:son, family = poisson, data = mob) Linear predictor - using glm.fit > Ru Call: gnm(formula = obs ~ country:father + country:son, family = poisson, data = mob) Coefficients: (Intercept) countryUnited States:fatherUpNonManual countryBritain:fatherUpNonManual countryJapan:fatherUpNonManual 5.21635 1.22559 0.01738 -1.29835 countryUnited States:fatherLowNonManual countryBritain:fatherLowNonManual countryJapan:fatherLowNonManual countryUnited States:fatherUpManual 1.36049 0.12311 -0.91583 1.73724 countryBritain:fatherUpManual countryJapan:fatherUpManual countryUnited States:fatherLowManual countryBritain:fatherLowManual 0.94212 -1.24214 2.11724 1.53071 countryJapan:fatherLowManual countryUnited States:fatherFarm countryBritain:fatherFarm countryJapan:fatherFarm -1.56583 1.93384 -0.08730 NA countryUnited States:sonLowNonManual countryBritain:sonLowNonManual countryJapan:sonLowNonManual countryUnited States:sonUpManual -0.60623 -0.59203 0.46687 -0.24537 countryBritain:sonUpManual countryJapan:sonUpManual countryUnited States:sonLowManual countryBritain:sonLowManual 0.04907 0.13103 0.02770 0.50530 countryJapan:sonLowManual countryUnited States:sonFarm countryBritain:sonFarm countryJapan:sonFarm 0.16127 -1.88021 -1.97165 -0.06721 Deviance: 5591.518 Pearson chi-squared: 6659.598 Residual df: 48 > # df =33 > Ru2 <- gnm(obs~ country:father + country:son + Diag(father, son):country, family = poisson, data = mob) Linear predictor - using glm.fit > Ru2 Call: gnm(formula = obs ~ country:father + country:son + Diag(father, son):country, family = poisson, data = mob) Coefficients: (Intercept) countryUnited States:fatherUpNonManual countryBritain:fatherUpNonManual 4.9267 0.9199 -0.3151 countryJapan:fatherUpNonManual countryUnited States:fatherLowNonManual countryBritain:fatherLowNonManual -1.3648 1.5152 0.2703 countryJapan:fatherLowNonManual countryUnited States:fatherUpManual countryBritain:fatherUpManual -0.9100 1.9290 1.1390 countryJapan:fatherUpManual countryUnited States:fatherLowManual countryBritain:fatherLowManual -1.1857 2.2384 1.5941 countryJapan:fatherLowManual countryUnited States:fatherFarm countryBritain:fatherFarm -1.3043 2.0325 -0.1028 countryJapan:fatherFarm countryUnited States:sonLowNonManual countryBritain:sonLowNonManual NA -0.4868 -0.4788 countryJapan:sonLowNonManual countryUnited States:sonUpManual countryBritain:sonUpManual 0.5339 -0.0940 0.1924 countryJapan:sonUpManual countryUnited States:sonLowManual countryBritain:sonLowManual 0.2273 0.1029 0.4726 countryJapan:sonLowManual countryUnited States:sonFarm countryBritain:sonFarm 0.4000 -3.0855 -2.9613 countryJapan:sonFarm countryUnited States:Diag(father, son)Farm countryBritain:Diag(father, son)Farm -1.2458 2.5971 3.3897 countryJapan:Diag(father, son)Farm countryUnited States:Diag(father, son)LowManual countryBritain:Diag(father, son)LowManual 2.1030 0.3557 0.4961 countryJapan:Diag(father, son)LowManual countryUnited States:Diag(father, son)LowNonManual countryBritain:Diag(father, son)LowNonManual 0.1673 0.4369 0.6664 countryJapan:Diag(father, son)LowNonManual countryUnited States:Diag(father, son)UpManual countryBritain:Diag(father, son)UpManual 0.7822 0.1902 0.2478 countryJapan:Diag(father, son)UpManual countryUnited States:Diag(father, son)UpNonManual countryBritain:Diag(father, son)UpNonManual 0.8357 1.3042 1.5496 countryJapan:Diag(father, son)UpNonManual 1.2823 Deviance: 1336.205 Pearson chi-squared: 1409.762 Residual df: 33 > > # FI(x) > unidiff <- gnm(obs~ country*father + country*son + Diag(father, son):country + Mult(country, father:son), ofInterest="[.]country", family = poisson, data = mob, trace=TRUE) Initialising Initial Deviance = 1355.935 Running start-up iterations Start-up iteration 1. Deviance = 34.98261 Start-up iteration 2. Deviance = 30.98474 Running main iterations Iteration 1. Deviance = 30.94010 Iteration 2. Deviance = 30.93978 Iteration 3. Deviance = 30.93977 Iteration 4. Deviance = 30.93977 Iteration 5. Deviance = 30.93977 Iteration 6. Deviance = 30.93977 Done Warning message: In strsplit(specialTerms, ", inst = |,? ?\\)$", perl = TRUE) : perl = TRUE is only fully implemented in UTF-8 locales > unidiff Call: gnm(formula = obs ~ country * father + country * son + Diag(father, son):country + Mult(country, father:son), ofInterest = "[.]country", family = poisson, data = mob, trace = TRUE) Coefficients of interest: Mult(., father:son).countryUnited States Mult(., father:son).countryBritain Mult(., father:son).countryJapan 0.11141 0.11585 0.08903 Deviance: 30.93977 Pearson chi-squared: 30.70676 Residual df: 20 > getContrasts(unidiff, pickCoef(unidiff, "[.]country"), ref="first", scaleRef="first", scaleWeights="unit") $covmat Mult(., father:son).countryUnited States Mult(., father:son).countryBritain Mult(., father:son).countryJapan Mult(., father:son).countryUnited States 1.920927e-05 5.974430e-06 4.205603e-06 Mult(., father:son).countryBritain 5.974430e-06 5.727665e-05 3.438620e-06 Mult(., father:son).countryJapan 4.205603e-06 3.438620e-06 9.871284e-05 $qvframe Estimate Std. Error Mult(., father:son).countryUnited States 0.0000000 0.00000000 Mult(., father:son).countryBritain 0.1945751 0.36221338 Mult(., father:son).countryJapan -0.9808876 0.07185094 $relerrs NULL $modelcall gnm(formula = obs ~ country * father + country * son + Diag(father, son):country + Mult(country, father:son), ofInterest = "[.]country", family = poisson, data = mob, trace = TRUE) attr(,"class") [1] "qv" >