rmh at temple.edu
2009-Mar-06 15:55 UTC
[Rd] bug in summary.aovlist() with split= and (PR#13579)
-------62a8e378fd5c9332aae960888fd28459 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit # R for Windows will not send your bug report automatically. # Please copy the bug report (after finishing it) to # your favorite email program and send it to # # r-bugs at r-project.org # ###################################################### summary.aovlist() with split= and expand.split=TRUE gives two different types of nonsensical results for a:b in the Within stratum in the two different expansions of tmp3.aov. S-Plus gives appropriate results and I attach them for comparison. There are three attached files. split.r source split.rt R transcript showing nonsense results split.st S-Plus transcript showing appropriate results Rich --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = i386 os = mingw32 system = i386, mingw32 status = major = 2 minor = 8.1 year = 2008 month = 12 day = 22 svn rev = 47281 language = R version.string = R version 2.8.1 (2008-12-22) Windows XP (build 2600) Service Pack 3 Locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 Search Path: .GlobalEnv, package:RcmdrPlugin.HH, package:Rcmdr, package:car, package:tcltk, package:fortunes, package:VGAM, package:stats4, package:splines, package:HH, package:leaps, package:multcomp, package:mvtnorm, package:grid, package:lattice, package:stats, package:graphics, package:datasets, package:grDevices, package:rcom, package:rscproxy, package:utils, package:methods, RExcelEnv, RcmdrEnv, Autoloads, package:base -------62a8e378fd5c9332aae960888fd28459 Content-Type: text/plain; name="split.r" Content-Disposition: inline; filename="split.r" Content-Transfer-Encoding: quoted-printable tmp <- data.frame(y=3Drnorm(48), a=3Drep(letters[1:3], 16), b=3Drep(rep(LETTERS[1:4], each=3D3),4), block=3Drep(LETTERS[5:6], each=3D24) ) tmp.aov <- aov(y ~ a*b, data=3Dtmp) summary(tmp.aov, split=3Dlist(a=3Dlist(t=3D1,u=3D2), b=3Dlist(v=3D1,w=3D2,x=3D3)), expand.split=3DTRUE) tmp2.aov <- aov(y ~ Error(block) + a*b, data=3Dtmp) summary(tmp2.aov, split=3Dlist(a=3Dlist(t=3D1,u=3D2), b=3Dlist(v=3D1,w=3D2,x=3D3)), expand.split=3DTRUE) summary(tmp2.aov, split=3Dlist(a=3Dlist(t=3D1,u=3D2)), expand.split=3DTRUE) tmp3.aov <- aov(y ~ Error(block/a) + a*b, data=3Dtmp) summary(tmp3.aov, split=3Dlist(a=3Dlist(t=3D1,u=3D2), b=3Dlist(v=3D1,w=3D2,x=3D3)), expand.split=3DTRUE) summary(tmp3.aov, split=3Dlist(a=3Dlist(t=3D1,u=3D2)), expand.split=3DTRUE) -------62a8e378fd5c9332aae960888fd28459 Content-Type: text/plain; name="split.rt" Content-Disposition: inline; filename="split.rt" Content-Transfer-Encoding: quoted-printable> tmp <- data.frame(y=3Drnorm(48),+ a=3Drep(letters[1:3], 16), + b=3Drep(rep(LETTERS[1:4], each=3D3),4), + block=3Drep(LETTERS[5:6], each=3D24) + )> > tmp.aov <- aov(y ~ a*b, data=3Dtmp) > summary(tmp.aov,+ split=3Dlist(a=3Dlist(t=3D1,u=3D2), b=3Dlist(v=3D1,w=3D2,x=3D3)), + expand.split=3DTRUE) Df Sum Sq Mean Sq F value Pr(>F) a 2 2.060 1.030 1.0528 0.3595 a: t 1 1.411 1.411 1.4416 0.2377 a: u 1 0.650 0.650 0.6639 0.4205 b 3 0.839 0.280 0.2859 0.8353 b: v 1 0.264 0.264 0.2702 0.6063 b: w 1 0.001 0.001 0.0013 0.9711 b: x 1 0.573 0.573 0.5860 0.4489 a:b 6 2.300 0.383 0.3918 0.8794 a:b: t.v 1 0.556 0.556 0.5685 0.4558 a:b: u.v 1 0.998 0.998 1.0203 0.3192 a:b: t.w 1 0.171 0.171 0.1747 0.6785 a:b: u.w 1 0.092 0.092 0.0942 0.7607 a:b: t.x 1 0.361 0.361 0.3685 0.5476 a:b: u.x 1 0.122 0.122 0.1246 0.7261 Residuals 36 35.226 0.978> > tmp2.aov <- aov(y ~ Error(block) + a*b, data=3Dtmp) > summary(tmp2.aov,+ split=3Dlist(a=3Dlist(t=3D1,u=3D2), b=3Dlist(v=3D1,w=3D2,x=3D3)), + expand.split=3DTRUE) Error: block Df Sum Sq Mean Sq F value Pr(>F) Residuals 1 0.57849 0.57849 Error: Within Df Sum Sq Mean Sq F value Pr(>F) a 2 2.060 1.030 1.0406 0.3639 a: t 1 1.411 1.411 1.4250 0.2406 a: u 1 0.650 0.650 0.6563 0.4234 b 3 0.839 0.280 0.2826 0.8376 b: v 1 0.264 0.264 0.2671 0.6085 b: w 1 0.001 0.001 0.0013 0.9713 b: x 1 0.573 0.573 0.5793 0.4517 a:b 6 2.300 0.383 0.3873 0.8822 a:b: t.v 1 0.556 0.556 0.5619 0.4585 a:b: u.v 1 0.998 0.998 1.0085 0.3222 a:b: t.w 1 0.171 0.171 0.1727 0.6803 a:b: u.w 1 0.092 0.092 0.0931 0.7621 a:b: t.x 1 0.361 0.361 0.3642 0.5500 a:b: u.x 1 0.122 0.122 0.1232 0.7277 Residuals 35 34.647 0.990> summary(tmp2.aov,+ split=3Dlist(a=3Dlist(t=3D1,u=3D2)), + expand.split=3DTRUE) Error: block Df Sum Sq Mean Sq F value Pr(>F) Residuals 1 0.57849 0.57849 Error: Within Df Sum Sq Mean Sq F value Pr(>F) a 2 2.060 1.030 1.0406 0.3639 a: t 1 1.411 1.411 1.4250 0.2406 a: u 1 0.650 0.650 0.6563 0.4234 b 3 0.839 0.280 0.2826 0.8376 a:b 6 2.300 0.383 0.3873 0.8822 a:b: t 3 1.088 0.363 0.3663 0.7777 a:b: u 3 1.212 0.404 0.4082 0.7480 Residuals 35 34.647 0.990> > tmp3.aov <- aov(y ~ Error(block/a) + a*b, data=3Dtmp) > summary(tmp3.aov,+ split=3Dlist(a=3Dlist(t=3D1,u=3D2), b=3Dlist(v=3D1,w=3D2,x=3D3)), + expand.split=3DTRUE) Error: block Df Sum Sq Mean Sq F value Pr(>F) Residuals 1 0.57849 0.57849 Error: block:a Df Sum Sq Mean Sq F value Pr(>F) a 2 2.0603 1.0301 0.4883 0.6719 a: t 1 1.4106 1.4106 0.6686 0.4994 a: u 1 0.6497 0.6497 0.3079 0.6347 Residuals 2 4.2194 2.1097 Error: Within Df Sum Sq Mean Sq F value Pr(>F) b 3 0.8392 0.2797 0.3034 0.8227 b: v 1 0.2644 0.2644 0.2868 0.5959 b: w 1 0.0013 0.0013 0.0014 0.9703 b: x 1 0.5734 0.5734 0.6219 0.4360 a:b 6 2.3002 0.3834 0.4158 0.8632 a:b: t.v 1 a:b: u.v 1 a:b: t.w 1 a:b: u.w 1 a:b: t.x 1 a:b: u.x 1 Residuals 33 30.4279 0.9221> summary(tmp3.aov,+ split=3Dlist(a=3Dlist(t=3D1,u=3D2)), + expand.split=3DTRUE) Error: block Df Sum Sq Mean Sq F value Pr(>F) Residuals 1 0.57849 0.57849 Error: block:a Df Sum Sq Mean Sq F value Pr(>F) a 2 2.0603 1.0301 0.4883 0.6719 a: t 1 1.4106 1.4106 0.6686 0.4994 a: u 1 0.6497 0.6497 0.3079 0.6347 Residuals 2 4.2194 2.1097 Error: Within Df Sum Sq Mean Sq F value Pr(>F) b 3 0.8392 0.2797 0.3034 0.8227 a:b 6 2.3002 0.3834 0.4158 0.8632 a:b: t 0 0.0000 a:b: u 0 0.0000 Residuals 33 30.4279 0.9221> > version_ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 8.1 year 2008 month 12 day 22 svn rev 47281 language R version.string R version 2.8.1 (2008-12-22)>-------62a8e378fd5c9332aae960888fd28459 Content-Type: text/plain; name="split.st" Content-Disposition: inline; filename="split.st" Content-Transfer-Encoding: quoted-printable> tmp <- data.frame(y=3Drnorm(48),+ a=3Drep(letters[1:3], 16), + b=3Drep(rep(LETTERS[1:4], each=3D3),4), + block=3Drep(LETTERS[5:6], each=3D24) + )> > tmp.aov <- aov(y ~ a*b, data=3Dtmp) > summary(tmp.aov,+ split=3Dlist(a=3Dlist(t=3D1,u=3D2), b=3Dlist(v=3D1,w=3D2,x=3D3)), + expand.split=3DTRUE) Df Sum of Sq Mean Sq F Value Pr(F) a 2 0.36016 0.180078 0.141799 0.8682780 a: t 1 0.03839 0.038393 0.030232 0.8629384 a: u 1 0.32176 0.321762 0.253366 0.6177813 b 3 4.96430 1.654765 1.303014 0.2883921 b: v 1 4.84859 4.848586 3.817929 0.0585102 b: w 1 0.10289 0.102887 0.081017 0.7775555 b: x 1 0.01282 0.012823 0.010097 0.9205175 a:b 6 3.78177 0.630295 0.496314 0.8068076 a:b: t.v 1 0.08038 0.080378 0.063292 0.8027964 a:b: u.v 1 0.68080 0.680800 0.536083 0.4688007 a:b: t.w 1 2.29276 2.292763 1.805394 0.1874701 a:b: u.w 1 0.47283 0.472829 0.372321 0.5455749 a:b: t.x 1 0.10382 0.103815 0.081747 0.7765822 a:b: u.x 1 0.15119 0.151185 0.119048 0.7320772 Residuals 36 45.71826 1.269952> > tmp2.aov <- aov(y ~ Error(block) + a*b, data=3Dtmp) > summary(tmp2.aov,+ split=3Dlist(a=3Dlist(t=3D1,u=3D2), b=3Dlist(v=3D1,w=3D2,x=3D3)), + expand.split=3DTRUE) Error: block Df Sum of Sq Mean Sq F Value Pr(F) Residuals 1 0.01256877 0.01256877 Error: Within Df Sum of Sq Mean Sq F Value Pr(F) a 2 0.36016 0.180078 0.137898 0.8716586 a: t 1 0.03839 0.038393 0.029401 0.8648450 a: u 1 0.32176 0.321762 0.246395 0.6227280 b 3 4.96430 1.654765 1.267168 0.3006705 b: v 1 4.84859 4.848586 3.712896 0.0621432 b: w 1 0.10289 0.102887 0.078788 0.7805996 b: x 1 0.01282 0.012823 0.009819 0.9216304 a:b 6 3.78177 0.630295 0.482660 0.8166555 a:b: t.v 1 0.08038 0.080378 0.061551 0.8055105 a:b: u.v 1 0.68080 0.680800 0.521335 0.4750693 a:b: t.w 1 2.29276 2.292763 1.755727 0.1937442 a:b: u.w 1 0.47283 0.472829 0.362078 0.5512326 a:b: t.x 1 0.10382 0.103815 0.079498 0.7796389 a:b: u.x 1 0.15119 0.151185 0.115773 0.7356989 Residuals 35 45.70569 1.305877> summary(tmp2.aov,+ split=3Dlist(a=3Dlist(t=3D1,u=3D2)), + expand.split=3DTRUE) Error: block Df Sum of Sq Mean Sq F Value Pr(F) Residuals 1 0.01256877 0.01256877 Error: Within Df Sum of Sq Mean Sq F Value Pr(F) a 2 0.36016 0.180078 0.137898 0.8716586 a: t 1 0.03839 0.038393 0.029401 0.8648450 a: u 1 0.32176 0.321762 0.246395 0.6227280 b 3 4.96430 1.654765 1.267168 0.3006705 a:b 6 3.78177 0.630295 0.482660 0.8166555 a:b: t 3 2.47696 0.825652 0.632259 0.5991524 a:b: u 3 1.30481 0.434938 0.333062 0.8014781 Residuals 35 45.70569 1.305877> > tmp3.aov <- aov(y ~ Error(block/a) + a*b, data=3Dtmp) > summary(tmp3.aov,+ split=3Dlist(a=3Dlist(t=3D1,u=3D2), b=3Dlist(v=3D1,w=3D2,x=3D3)), + expand.split=3DTRUE) Error: block Df Sum of Sq Mean Sq F Value Pr(F) Residuals 1 0.01256877 0.01256877 Error: a %in% block Df Sum of Sq Mean Sq F Value Pr(F) a 2 0.360156 0.180078 0.0884982 0.9186970 a: t 1 0.038393 0.038393 0.0188683 0.9033255 a: u 1 0.321762 0.321762 0.1581281 0.7293139 Residuals 2 4.069638 2.034819 Error: Within Df Sum of Sq Mean Sq F Value Pr(F) b 3 4.96430 1.654765 1.311538 0.2871289 b: v 1 4.84859 4.848586 3.842903 0.0584446 b: w 1 0.10289 0.102887 0.081546 0.7769973 b: x 1 0.01282 0.012823 0.010163 0.9203096 a:b 6 3.78177 0.630295 0.499561 0.8040295 a:b: t.v 1 0.08038 0.080378 0.063706 0.8022963 a:b: u.v 1 0.68080 0.680800 0.539590 0.4677908 a:b: t.w 1 2.29276 2.292763 1.817204 0.1868277 a:b: u.w 1 0.47283 0.472829 0.374756 0.5446185 a:b: t.x 1 0.10382 0.103815 0.082282 0.7760218 a:b: u.x 1 0.15119 0.151185 0.119827 0.7314199 Residuals 33 41.63605 1.261699> summary(tmp3.aov,+ split=3Dlist(a=3Dlist(t=3D1,u=3D2)), + expand.split=3DTRUE) Error: block Df Sum of Sq Mean Sq F Value Pr(F) Residuals 1 0.01256877 0.01256877 Error: a %in% block Df Sum of Sq Mean Sq F Value Pr(F) a 2 0.360156 0.180078 0.0884982 0.9186970 a: t 1 0.038393 0.038393 0.0188683 0.9033255 a: u 1 0.321762 0.321762 0.1581281 0.7293139 Residuals 2 4.069638 2.034819 Error: Within Df Sum of Sq Mean Sq F Value Pr(F) b 3 4.96430 1.654765 1.311538 0.2871289 a:b 6 3.78177 0.630295 0.499561 0.8040295 a:b: t 3 2.47696 0.825652 0.654397 0.5859203 a:b: u 3 1.30481 0.434938 0.344724 0.7931477 Residuals 33 41.63605 1.261699> versionTIBCO Spotfire S+ Version 8.1.1 for Microsoft Windows : 2008>-------62a8e378fd5c9332aae960888fd28459--